I am currently using a range of tutorials to make a FPS multiplayer game. I cannot figure out why the animations aren’t working considering the RPC’s are getting called. There are two settings, crouching and standing for the player. The animation for crouching plays as well as standing, but not the animations such as walking. I’ve put breakpoints at the lines for where the walking/idle animations change and they are hit properly. The debug log is also displayed at the right time as well. All the animations are looped in start, their layers are -9.
Here are the RPC functions:
@RPC
function SendStance(charStance : String, info : NetworkMessageInfo)
{
stance = System.Enum.Parse(typeof(charStanceState), charStance);
}
@RPC
function SetDirectionState(directionState : String, info : NetworkMessageInfo)
{
Debug.Log("directionState is "+directionState);
dirState = System.Enum.Parse(typeof(charDirState), directionState);
}
Both are getting called in Update, whenever the state changes from the previous state. SetStance is for crouching/standing, whenever you hit the c button this switching the stance. SetDirectionState is for changing the direction at which the player is looking and UpdateAnimation crossfades to the corresponding animation.
function Update ()
{
SetStanceState();
if(prevStance != stance && networkView.isMine)
{
networkView.RPC("SendStance", RPCMode.OthersBuffered, stance.ToString());
prevStance = stance;
}
SetDirectionState();
if(prevDirState != dirState)
{
networkView.RPC("SetDirectionState", RPCMode.OthersBuffered, dirState.ToString());
prevDirState = dirState;
}
UpdateCharacterAnim();
}
If anyone has any suggestions on how to animate characters using RPC please comment or answer. Thank you very much in advance because I’m at my whit’s end for this!