First of all, yes, I know that RPC’s are outdated but personally I like the legacy system more.
So I found a way to pass booleans through RPC easily (without int or other).
in JS you would do something like this
var myBool : boolean;
function Start(){
var nView = GetComponent.();
nView.RPC(“MyFunc”, RPCMode.AllBuffered, myBool.ToString());
}
@RPC
function MyFunc(b : String){
if(b == true.ToString()){
//true would go here
}
else{
//false here
}
}
And I’m not the best with C# but this is probably how it would go
public Bool myBool;
void Start(){
NetworkView nView = GetComponent(); //not exactly sure how to do local vars in C#
nView.RPC(“MyFunc”, RPCMode.AllBuffered, myBool.ToString());
}
[RPC]
void MyFunc(String b){
if(b == true.ToString()){
//true would go here
}
else{
//false here
}
}
I’d just figured this out and decided to make a thread for it, hopefully it wasn’t just a waist of time.
Maybe it will help a soul or two.