Hello everyone!
We are excited to release version 2.6.1 of Cloud Code C#! This release makes working with Cloud Code much easier and greatly improves your productivity. You can now automatically generate your game runtime code for your Cloud Code C# module!
Refer to the Demo and Documentation(Generate Bindings) for more information!
2 Likes
Here is an example of how you can now automatically generate a type-safe wrapper for your Module, significantly reducing the amount of boilerplate code needed to make calls to Cloud Code from your game client.
Given the following method exposed in Cloud Code:
[CloudCodeFunction("SayHello")]
public string SayHello(string name)
{
return $"Hello, {name}!"
}
Previously, in order to call this endpoint from your game client, you would need to write the following:
var message = CloudCodeService.Instance.CallModuleEndpointAsync<string>(
"MyModule",
"SayHello",
new Dictionary<string, string>( ) { { "name", "Bob" } });
With the new Bindings feature, this code can be greatly simplified to something like this:
var message = myModule.SayHello("Bob");
Custom classes used in your arguments or return types are included in the generated package, removing the need to manually duplicate these classes between your cloud and client code.
2 Likes
Are Bindings automatically generated when changing the cloud code script? or do i must re generate them manuallly?
Negative, you must generate them manually. It’s a tradeoff, since as you iterate on your module (and tests for your module as applicable), we’d be breaking your project if we re-gen your bindings. But we’ll take the feedback into account.
To be clear, it only supports Cloud Code C# modules , not Cloud Code JS scripts at the moment
1 Like