New to this multiplayer stuff in Unity.
Is there a good tutorial or thread or whatever that talks about how to sync multi-player animation states? Like detecting player movement/idleness and syncing that to the other connected players?
New to this multiplayer stuff in Unity.
Is there a good tutorial or thread or whatever that talks about how to sync multi-player animation states? Like detecting player movement/idleness and syncing that to the other connected players?
Anyone? I can’t be the first person to need to do this.
I create a new player character on-the-fly (see the character generator tutorial). I have a NetworkView on the game object containing the character script.
function Update()
{
// This is our own player
if (networkView.isMine)
{
speed = Input.GetAxis("Vertical") * 3;
if (Input.GetAxis("Vertical") > 0.2)
{
anim = "walk";
go.animation["walk"].speed = speed;
}
else if (Input.GetAxis("Vertical") < -0.2)
{
anim = "walk";
go.animation["walk"].speed = speed;
}
else
anim = "idle1";
go.animation.CrossFade (anim);
if (lastAnim != anim || lastSpeed != speed)
{
Debug.Log("sending anim "+anim);
networkView.RPC ("SetPlayerAnim", RPCMode.Others, anim);
}
}
lastAnim = anim;
lastSpeed = speed;
}
@RPC
function SetPlayerAnim (animStr : String)
{
Debug.Log("got me an anim "+animStr);
anim = animStr;
go.animation.CrossFade (anim);
}
So when I start or stop moving, I get (my own) console messages that I’m sending the anim string.
However, I NEVER see the SetPlayerAnim call, no console message, no state from the other players.