My code looks like this:
var score = ((Dictionary<string, object>)entry.Value)["score"];
print("score: " + score + "!");
FBManager.instance.friends[id].score = (int) score;
//OUTPUT:
//score: 5!
//InvalidCastException: Specified cast is not valid.
Why can't I cast score
to int?
I'm pretty sure entry.Value
is a Dictionary<string, object>
because I printed entry.Value.GetType()
and it said exactly this.