Reminder that there's a discord server for Game Devs with official support from many Services including BC. Braincloud seems a bit inactive in that server. Would be great to have some extra staff in there for showcasing.
Panagiotis Milios
@Panagiotis Milios
Best posts made by Panagiotis Milios
-
Discord Server
-
RE: Unity basic setup
Yes, that solved the problem. Thanks for your input Chris. Although, i'm always "scared" of using statics so i ended up doing it in a kindly different way.
Since the forum is new, i'll post the solution here in case any future newbies like myself get stuck in the same problem. It's more of a Unity problem and less of a BrainCloud problem but thanks to BC support, i understood what i was doing wrong.
In order to use BrainCloud in multiple scenes you can either use a static variable like Chris said (it's easier doing it like that) or you need to create a GameObject and attach to it the script below.
using UnityEngine; public class BCConfig : MonoBehaviour { private BrainCloudWrapper _bc; public BrainCloudWrapper GetBrainCloud() { return _bc; } void Awake() { gameObject.name = "BrainCloud"; // I assign the name Braincloud to my game object to use it in the Find() function _bc = gameObject.AddComponent<BrainCloudWrapper>(); _bc.WrapperName = "MyWrapper"; // optionally set a wrapper-name _bc.Init(); // extra data, such as: _appId, _secret and _appVersion, is taken from the brainCloud Unity Plugin. See Installation Guide above DontDestroyOnLoad(gameObject); } }
In some other scene where you need access to the _bc variable you just simply do the following on the start method:
_bc = GameObject.Find("BrainCloud").GetComponent<BCConfig>().GetBrainCloud();
edit: small fix made to the example code, by a brainCloud mod (@Jonathan)
-
RE: Don't discourage modulation by charging per in-house calls
My only complaint i have about the cloud-code API policy is that after the first 3 API calls, each extra API call should be charged at a rate of 0.33 instead of 0.5. Basically with the cloud code API policy, Braincloud charges 3.33$ for the first million and 5$ for every extra million API calls in cloud code.
i.e In a Cloud script with 9 'Pure' API calls that's called 333.333 times within a month (total: ~3 million 'pure' API Calls) the first million is basically charged at 3.33$ and the other 2 millions are charged at 5$. So total charge would be: 13.33$ which is true since this cloud script counts as 4 actual API Calls (total: 1,333,332 API calls).
But if my use-case allowed, i could break this Cloud Script in 3 different Cloud Scripts (3 api calls each) and call them from the client in order and using the return result as input to the next cloud-script to continue exactly where i left it. Now that would be 999.999 total API calls and i just saved for myself 3.33$ but in reality the backend did a lot more work.
Please do consider my suggestion of reducing the API count rate at 0.33
Latest posts made by Panagiotis Milios
-
RE: Don't discourage modulation by charging per in-house calls
My only complaint i have about the cloud-code API policy is that after the first 3 API calls, each extra API call should be charged at a rate of 0.33 instead of 0.5. Basically with the cloud code API policy, Braincloud charges 3.33$ for the first million and 5$ for every extra million API calls in cloud code.
i.e In a Cloud script with 9 'Pure' API calls that's called 333.333 times within a month (total: ~3 million 'pure' API Calls) the first million is basically charged at 3.33$ and the other 2 millions are charged at 5$. So total charge would be: 13.33$ which is true since this cloud script counts as 4 actual API Calls (total: 1,333,332 API calls).
But if my use-case allowed, i could break this Cloud Script in 3 different Cloud Scripts (3 api calls each) and call them from the client in order and using the return result as input to the next cloud-script to continue exactly where i left it. Now that would be 999.999 total API calls and i just saved for myself 3.33$ but in reality the backend did a lot more work.
Please do consider my suggestion of reducing the API count rate at 0.33
-
Web Payments
Any chance web payment support will be integrated in Braincloud in the near future (Before 2022)?
-
Discord Server
Reminder that there's a discord server for Game Devs with official support from many Services including BC. Braincloud seems a bit inactive in that server. Would be great to have some extra staff in there for showcasing.
-
RE: Unity basic setup
Yes, that solved the problem. Thanks for your input Chris. Although, i'm always "scared" of using statics so i ended up doing it in a kindly different way.
Since the forum is new, i'll post the solution here in case any future newbies like myself get stuck in the same problem. It's more of a Unity problem and less of a BrainCloud problem but thanks to BC support, i understood what i was doing wrong.
In order to use BrainCloud in multiple scenes you can either use a static variable like Chris said (it's easier doing it like that) or you need to create a GameObject and attach to it the script below.
using UnityEngine; public class BCConfig : MonoBehaviour { private BrainCloudWrapper _bc; public BrainCloudWrapper GetBrainCloud() { return _bc; } void Awake() { gameObject.name = "BrainCloud"; // I assign the name Braincloud to my game object to use it in the Find() function _bc = gameObject.AddComponent<BrainCloudWrapper>(); _bc.WrapperName = "MyWrapper"; // optionally set a wrapper-name _bc.Init(); // extra data, such as: _appId, _secret and _appVersion, is taken from the brainCloud Unity Plugin. See Installation Guide above DontDestroyOnLoad(gameObject); } }
In some other scene where you need access to the _bc variable you just simply do the following on the start method:
_bc = GameObject.Find("BrainCloud").GetComponent<BCConfig>().GetBrainCloud();
edit: small fix made to the example code, by a brainCloud mod (@Jonathan)
-
Unity basic setup
Hello,
Unity noob here, trying to understand how to properly use Braincloud in Unity for different scenes. So far i've attached the following script in an empty GameObject and it succesfully passes through scenes.
public class BCConfig : MonoBehaviour { private BrainCloudWrapper _bc; public BrainCloudWrapper GetBrainCloud() { return _bc; } void Awake() { DontDestroyOnLoad(this.gameObject); _bc = this.gameObject.AddComponent<BrainCloudWrapper>(); _bc.WrapperName = gameObject.name; // Optional: Set a wrapper name _bc.Init(); // Init data is taken from the brainCloud Unity Plugin } }
Now in a different scene, in the start() function i use this: _bc = BCConfig.GetBrainCloud(); but i get an error (Object reference not set to an instance of an object).
What am i missing here? Would using a static BraincloudWrapper work aswell?