I am making a multiplayer game and I have a score script attached to the player, so when that player enters a sphere with a collider, it increments a value in his script.
Sorry if this doesn’t make any sense.
this is the sphere code
function OnTriggerEnter(other : Collider){
Debug.Log("Trigger Entered");
renderer.enabled = false;
collider.isTrigger = false;
collider.enabled = false;
//yield WaitForSeconds ( Random.Range(1.0, 10.0));
yield WaitForSeconds (3);
renderer.enabled = true;
collider.isTrigger = true;
collider.enabled = true;
}
and this is the player code
var score:int = 0;
var opScore:int = 0;
var sphereSettingsInstance:sphereSettings;
if(sphereSettingsInstance.OnTriggerEnter()){
score++;
}
function OnGUI () {
if(networkView.isMine){
GUI.Label (Rect (10, 10, 100, 20), "Your score is: " + score);
GUI.Label (Rect (100, 100, 200, 20), "Opponents score is: " + opScore);
}
}