using System.Collections; using System.Collections.Generic; using UnityEngine; using Mirror; using UnityEngine.Events; public class PushButton : NetworkBehaviour { public UnityEvent OnServerActivate; public UnityEvent OnActivate; void OnTriggerEnter2D(Collider2D other) { Debug.Log(other.name + " Entered"); if(!isServer){ return; } if(other.GetComponent()!=null){ //Player entered Debug.Log($"{other.name} Invoked server push button"); OnServerActivate.Invoke(); OnActivate.Invoke(); RpcActivate(); gameObject.SetActive(false); } } [ClientRpc] void RpcActivate(){ OnActivate.Invoke(); gameObject.SetActive(false); } }