Question by
Good_Comrade · Dec 03, 2019 at 03:09 AM ·
photonontriggerenterrpcpun
OnTriggerEnter worked only on master client
Hi there
I'm newbee and I need help.
I create mechanic where if you go into collider, his changed you gravity & transform direction. It's works in singleplayer, but if I want activate this mechanic on connected client, OnTriggerEnter worked only on master client. Also i don't understand, how pun rpc worked
My code:
private void OnTriggerEnter(Collider coll)
{
if (coll.gameObject.layer == 31 && charLoco != null)
{
GetComponent<PhotonView>().RPC("ChangeGravity", RpcTarget.All, null);
}
}
[PunRPC]
void ChangeGravity()
{
m_CharacterLocomotion.GravityDirection = grav;
}
Thanks for help!
Comment
Your answer
Follow this Question
Related Questions
Unity3D photon. bool resets. 0 Answers
PhotonUnity player move object problem ! 1 Answer
[PUN] How do I use RPCs the right way? 1 Answer
PhotonPun RPC functions Doesnt Work For Both the Players 0 Answers