[ad_1]
I’m creating an FPS recreation in native multiplayer. One participant creates the hot-spot recreation, and the opposite one connects by means of WiFi community and performs the sport. And i’m doing this utilizing unity MultiLan Package deal obtainable in Unity Belongings Retailer.
when the participant connect with the Sport i play the participant animation like stroll , bounce and so on. However the issue is animation can play solely which participant who host the Sport, not play to different participant who be a part of the Sport in host community.
That’s Participant Script.
personal MNetwork networkSrc;
public Btn_Jump jumpScript;
public Btn_DPad Btn_DpadScript;
void Awake() {
if (GetComponent<NetworkView>().isMine) {
trans = rework;
contr = trans.GetComponent<CharacterController>();
if (jumpScript == null) {
jumpScript = GameObject.Discover ("3 Bounce").GetComponent<Btn_Jump> ();
}
if (Btn_DpadScript == null) {
Btn_DpadScript = GameObject.Discover ("6 D-Pad").GetComponent<Btn_DPad> ();
}
}
}
void Begin() {
if (GetComponent<NetworkView>().isMine) {
// If it is my participant : search the networkManager part
networkSrc = GameObject.Discover("MNetwork").GetComponent<MNetwork>();
PlayerAnimatorComponent = GameObject.Discover ("Swat").GetComponent<Animator> ();
FPS_Events.ChangeCharacterMotor(motor);
}
}
void Replace() {
if (!networkSrc.isPlayerExitGame) {
if (currentMotor == null)
FPS_Events.ChangeCharacterMotor (motor);
attempt {
currentMotor.Replace ();
} catch {
}
if (jumpScript.Player_jump) {
}
if (Btn_DpadScript.Player_Run) {
RunAnimation ();
}
}
}
void RunAnimation(){
GetComponent<NetworkView> ().RPC ("SyncAnimation", RPCMode.All);
}
[RPC]
void SyncAnimation(){
if (Btn_DpadScript.Player_Run) {
PlayerAnimatorComponent.SetFloat ("Stroll",2f,0.1f,Time.deltaTime);
}
}
On this Script there may be “Btn_DpadScript” object of Digital joystick Script identify is “Btn_DPad” for Participant Motion.
When participant transfer then “Player_Run” Boolean variable is true and play the Stroll animation of participant in SyncAnimation() methodology.
However it’s caught to play animation in all participant in similar community.
Anybody can know the right way to play animation in all community participant utilizing MultiLan Package deal then inform me. I am unable to present in Google Search about participant Animation in community utilizing MultiLan Package deal.
what ought to i do do not know anyone can suggestion then i actually respect thanks.
[ad_2]