I have a gameobject in both client and server to which I’ve attached as script which only contains an enum
enum loginResults {
successLogin,
failBadCredentials,
failSameAcct,
failDoubleAcct,
failDBError
}
In both the client and server the enum is recognized but when I try to pass the enum through an RPC I get an error saying it was expecting int32 and got loginResults.
networkView.RPC("LoginStatus", info.sender,loginResults.successLogin);
@RPC
function LoginStatus(reason : int) {
switch (reason) {
Ok, so I changed the RPC definitions to receive loginResults instead of int but then I get an error saying loginResults isn’t recognized.
@RPC
function LoginStatus(reason : loginResults) {
switch (reason) {
Hmmm I say… They I changed the definitions back to int and tried casting
networkView.RPC("LoginStatus", info.sender, (int)loginResults.successLogin);
but that just gives me syntax errors.
How do I go about passing an enum though RPC? Or should I give up on enums and use a pile of integer vars?