Question by
Sunniiee · Oct 13, 2015 at 02:59 AM ·
networkingprogrammingrpc
How do I pass a int value from one class to another with RPC?
So I'm making a game that passes the lives from one script to another but it doesnt seem to work. Here is my code snippets: Code from UIScript
public static int life1, public static int life2
[RPC]
void lifebars(int l1, int l2)
{
life1 = l1;
life2 = l2;
}
Code from class A:
[RPC]
void cubePosition (Vector3 pos, Vector3 rot, bool walk,
bool idle, bool guard, bool kote, bool doo, bool men, bool tsuki,
int l1, int l2)
{
transform.position = pos;
transform.eulerAngles = rot;
PlayerAni.SetBool ("Move", walk);
PlayerAni.SetBool ("Idle", idle);
PlayerAni.SetBool ("Guard", guard);
PlayerAni.SetBool ("Kote", kote); //attack1
PlayerAni.SetBool ("Do", doo); //attack2
PlayerAni.SetBool ("Men", men); //attack3
PlayerAni.SetBool ("Tsuki", tsuki);//attack4
UIScript.life1= l1;
UIScript.life2 = l2;
}
`
Comment