Skip to content
  • [Unity] In App Purchases

    Solved APIs unity in app purchases mobile
    2
    0 Votes
    2 Posts
    1k Views
    J
    brainCloud supports a wide range of popular in-app purchases, including Google Play, Apple, Facebook, Amazon, and Steam, etc.. In most cases, the purchase process is initiated through the corresponding IAP plugin that you need to download into your Unity project. Then, verify the receipt received from the purchase outcome with brainCloud by calling VerifyPurchase API. It should be noted that the necessary configuration for the IAP store must be set up in the brainCloud portal for your app, including the products section and platforms section. Some store integration examples are available on our documentation website -- https://docs.braincloudservers.com/learn/portal-tutorials/store-integration-google/ Hope this helps!
  • 0 Votes
    1 Posts
    757 Views
    No one has replied
  • Difficulty parsing JSON response in Unity

    APIs unity json jsonutility
    2
    0 Votes
    2 Posts
    1k Views
    Michael CostaM
    Hello! Thanks for your inquiry. The format of this response has been used for several years so to change it at this point would cause many errors for our clients. However, in situations like this, we have included the JsonFx library to help deserialize dynamic JSON objects with. One way to deserialize the JSON items would be to include a DeserializeItems(string) method in your Data class to be able to store them in an array using JsonFx's JsonReader.Deserialize(string) method: public List<Item> Items = new List<object>(); public void DeserializeItems(string jsonResponse) { var response = JsonReader.Deserialize<Dictionary<string, object>>(jsonResponse); var data = response["data"] as Dictionary<string, object>; var items = data["items"] as Dictionary<string, object>; foreach (Dictionary<string, object> item in items.Values) { var newItem = new Item(); newItem.itemId = (string)item["itemId"]; newItem.defId = (string)item["boost_rapidfire"]; newItem.quantity = (int)item["quantity"]; // etc... Items.Add(newItem); } } Alternatively, you can also use JsonFx's JsonWriter.Serialize(object) method in the foreach loop to then be able to use Unity's JsonUtility to automatically map it as an Item. Understandably, both methods have their own pros and cons. However, it should be able to get the job done in this case. Hope this helps! Please let us know if you have further questions or inquiries about this.
  • Async match without opponent

    General unity async match
    6
    0 Votes
    6 Posts
    2k Views
    A
    Also looking for this type of functionality, so id +1 this feature request
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • Convert Anonymous to username/password

    APIs unity authentication
    2
    0 Votes
    2 Posts
    1k Views
    J
    Call AttachUniversalIdentity() method from client lib, the username is uniqueness enforced.
  • 0 Votes
    2 Posts
    1k Views
    A
    Hi, I temporarily solved it by adding this line in the proguard_user: -keep class com.braincloud.unity.* { *; } so the BrainCloud classes are no longer minified.
  • 0 Votes
    1 Posts
    660 Views
    No one has replied
  • 0 Votes
    1 Posts
    570 Views
    No one has replied
  • Authentication error - Unity iOS

    APIs unity error ios
    4
    0 Votes
    4 Posts
    2k Views
    A
    Hi Gavin, Did you resolve the crash issue on iOS? I am experiencing it as well, so I feel I must have missed something Cheers, Andreas
  • 0 Votes
    2 Posts
    926 Views
    J
    To limit operations like IncrementExperiencePoints() to cloud code only. This will essentially take away the ability to make these calls from the bare client API. You can see a script that enforces these restrictions here - https://getbraincloud.com/apidocs/cloud-code-central/handy-cloud-code-scripts/restrictclientcalls-script/ Refer to another post below for more strategies you can apply to prevent cheating: https://forums.getbraincloud.com/topic/23/discussion-strategies-to-prevent-cheating-in-tournaments
  • 0 Votes
    1 Posts
    623 Views
    No one has replied
  • Can I create a chat in Brain Cloud?

    General unity server chat authentication
    2
    0 Votes
    2 Posts
    983 Views
    Y
    I downloaded the BrianCloud plug in for Unreal Engine, I can integrate user authentication, and real-time chat between connected players in a day.
  • 0 Votes
    1 Posts
    564 Views
    No one has replied
  • User Entity vs Global Entity Indexed ID

    APIs unity cloudscript entities
    4
    0 Votes
    4 Posts
    2k Views
    Paul WinterhalderP
    Hi Chris, User entities are primarily indexed by profileId + entityType - so the singleton API will scale well no matter how many players you have. That said, if your use case gets more complicated, with say hundreds of entities of a particular type per user (say maybe you are modelling user created towns, that sort of thing) - you could consider using Owned Custom Entities instead. You can define addition, custom indexes for those... keeps those lookups fast and efficient. In addition, if you end up having >1000 Global Entities, you should definitely look at switching to Unowned Custom Entities. Same deal - you can define your own custom indexes... Hope that helps! Paul.
  • Recommended way to read Entity data? (Unity, C#)

    APIs unity entity
    3
    0 Votes
    3 Posts
    1k Views
    T
    @Henry-Smith said in Recommended way to read Entity data? (Unity, C#): Sorry to bring back an old thread, but I'm just learning the platform and I thought I'd share my solution to this. First, define a generic class to handle the raw json response data: eg. my Tut1_AddTwoNumbers api returns: {"data":{"response":{"answer":24},"success":true},"status":200} public class Response<T> { public ResponseData<T> data; public int status; } public class ResponseData<T> { public T response; public bool success; } Then for each api call that you have, define a class that contains the fields that are custom to that response. public class Tut1_AddTwoNumbersResponse { public int answer; } Now, you call your function and handle the response like this: public void Tut1_AddTwoNumbers() { string scriptName = "Tut1_AddTwoNumbers"; // Anonymous object to supply the params. var data = new { num1 = 16, num2 = 8 }; var jsonScriptData = JsonWriter.Serialize(data); SuccessCallback successCallback = (response, userdata) => { var responseObject = JsonReader.Deserialize<Response<Tut1_AddTwoNumbersResponse>>(response); //var responseObject = JObject.Parse(response); Debug.Log($"Success The answer is '{responseObject.data.response.answer}' | raw_json={response}"); }; FailureCallback failureCallback = (status, code, error, userdata) => { Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error)); }; // Call the script _bc.ScriptService.RunScript(scriptName, jsonScriptData, successCallback, failureCallback); } this line is the important part: JsonReader.Deserialize<Response<Tut1_AddTwoNumbersResponse>>(response); Hope that helps someone!