player prefs, saving the Rect of a gui position?

ive tried this, saving across server, and i got rpc error

Sending RPC failed because ‘saveMyCharacterToServer’ parameter 44 (UnityEngine.Rect) is not supported.
UnityEngine.NetworkView:RPC(String, RPCMode, Object)
traitorSystem:SaveMyCharacter() (at Assets/scripts/traitorSystem.js:640)
$:MoveNext() (at Assets/scripts/traitorSystem.js:596)

is this unallowed or is my code not allowing it lol
any help would be grand

1 Answer

1

You can’t send a rect by RPC - you need send the individual elements of the rect as separate parameters and reconstruct on the other end.

ahh this was the conclusion i was fearing actually haha, thanks for the very fast reply

You have one other choice. You can serialize lots of things to a byte[] send that and rehydrate on the other end. You could check out this article

thanks again, and thanks for the article, i have already saved the .x and .y positions of rect as floats, and it works well