- Home /
Is there anyway to disable clients GameObject instance from Server or Vice-versa?
I want to know how to disable object instantiated on client side from server and vice versa.
Answer by Omar47i · May 25, 2014 at 06:35 PM
do u mean that the object is instantiated only on client-side and not the server (not Network.Instantiate), then if that is the case then u need to attach a networkView to the g.o that u want to disable and then from the server side just access this g.o by any method u like and disable it , e.g
// server-side
GameObject.FindGameObjectWithTag("goName").networkView.RPC("Disable", client);
and the code on client-side may look like this :
// client-side script attached to the object that we want to disable
[RPC]
void Disable(NetworkMessageInfo msg)
{
gameObject.SetActive(false);
}
and u can just do it from the client to the server. it should work properly hope that help
Your answer
Follow this Question
Related Questions
Why is my MonoBehaviour never being deleted? 0 Answers
Authoritative Server and RPC Help 1 Answer
Source Gameobject rendered when using prefab 0 Answers
How to add components to all spawned prefabs ? 0 Answers
Random Room Selection 1 Answer