Hey,
i am trying to work with entities in unity (C#).
when i trying to create object with int values, the SetObject change it to bool, even if its high number.
do i need to save it as string? why?
Hey,
i am trying to work with entities in unity (C#).
when i trying to create object with int values, the SetObject change it to bool, even if its high number.
do i need to save it as string? why?
Can you provide more specifics? What does your SetObjects request look like and what does the GetObjects call return afterwards?
this is the full info:
1. "PlayerLevel" Class:
public int ID; public int Stars; public PowerUps PowerupsTaken;
2. "PowerUps" Class:
public int UndoMove; public int Teleport; public int Hint; public int TileStamp;
3. Reuest:
var data = new List<PlayerLevel>(); data.Add(new PlayerLevel()
{
ID = 1, Stars = 0,
PowerupsTaken = new PowerUps()
{
Hint=0,
Teleport=0,
TileStamp=0,
UndoMove=0
}
}); var dataList = new List<SetObject>() { new SetObject() { ObjectName = "PlayerLevelsList", DataObject = data }, new SetObject() { ObjectName = "CurrentLevel", DataObject = "1" } };
4. This is the result in the PlayFab game manager:
What do you think?
It looks like the JSON serializer on the C# side is interpreting the 1 and 0s as booleans. You can try putting them in quotes or writing the JSON yourself. Also, to isolate the problem to the client side, you can try grabbing a fiddler trace to determine whether the values are leaving the client as Booleans or Ints.
Just for the record, this was exactly what was happening to me. Putting all the information as string solved the problem.
2 People are following this question.