Sign In Register

How can we help you today?

Start a new topic

SetEventAttribute double, float, decimal in Unity SDK

As far as numbers go, currently you can only use long or int with SetEventAttribute in the Unity SDK without nesting the data inside GSRequestData. Long and int are both integers and I would like to be able to use doubles, floats, or decimals with SetEventAttribute.

3 people like this idea
1 Comment

 Hey James,

It would be nice to be have the attributes take a few extra types, but you can also send these using strings.

Using C#, you should be able to turn most of those types into string using the .ToString() method, then just send that to the event as an attribute.

Since javascript is type-safe, you shouldn't get any hassle getting those variables back as floats, as javascript will recognize them as floats as soon as you do some maths with them.

You can send any calculations you get in your cloud-code back as script data and in the Unity SDK you can get those values back as floats using response.ScriptData.GetFloat("your key").

Hope that helps,