Hi, I’m currently making some multiplayer game sample using M2H Network Tutorial, and currently I’m stuck. ![]()
In this game, I’m using mouse click to move the character and this is done by raycasting.
When my character clicks the cube, the cube’s isTrigger is set to true, which makes cube into trigger. (so character can actually move to the cube’s position without colliding) Then as my character enters the cube(which has become a trigger), it instantiates the sphere with isTrigger turned on(using Instantiate) and simulatenously makes my character and cube invisible (this is done by turning mesh renderer false). Then, if I click outside this sphere (so i’m clicking the plane where character is standing on), it makes my character and cube visible again, cube’s isTrigger becomes false and destroys sphere.
This process is well shown to the user who is achieving this, but this process cannot be shown to the other user who is connected and watching this process, like picture below:
So the user who made the server has clicked the cube, and instantiated the sphere and successfully made the character itself and the cube invisible.
But on client side, Client user is watching the Server user and as picture shows below, it is just running towards the cube, not doing the effects that is being done on server side.
This is code attatched to the cube.
public var sitModelPrefab: Transform;
public var sitModel;
public var Entered: boolean = false;
function OnTriggerEnter (other : Collider){
//Check to see if a player entered the gate, rather than some space debris.
if (other.gameObject.CompareTag("Player"))
{
// Make player and cube invisible
other.gameObject.GetComponent(MeshRenderer).enabled = false;
gameObject.GetComponent(MeshRenderer).enabled = false;
// Instantiate replacement sitting character model
sitModel = Instantiate(sitModelPrefab, transform.position, transform.rotation);
sitModel.collider.isTrigger = true;
//CopyTransformsRecurse(transform, sitModel);
}
}
function OnCollisionExit (other: Collision)
{
Debug.Log("Exiting Chair");
other.gameObject.GetComponent(MeshRenderer).enabled = true;
gameObject.GetComponent(MeshRenderer).enabled = true;
if(sitModel != null)
{
Destroy(sitModel.gameObject);
}
}
function Start()
{
collider.isTrigger = false;
}
function OnMouseDown()
{
collider.isTrigger = true;
}
function Update()
{
//Debug.Log("EnterPad is Trigger: " + collider.isTrigger);
}
Thank you for reading such a long story. Reason I’ve done really complex way of turning isTrigger on and off is because later on, I’m going to make this cube into chair and when my character touches it, character becomes invisible and replacement object which has appearance of character sitting on chair will be there. Is there any heroes who can help me with this?

