Hi all !
First of all I must say that I’m a beginner (you’ll see that with my question…)
This is my script, I want to test a specific gameobject in the “public GameObject Cube” (I drag and drop the gameobject I want to test in this field).
In fact it’s working but all gameobjects who get in the trigger work, and I don’t want this, I want only the one I’ve put in the cube field to work and I don"t know how to do it… Thanks for any help !
using UnityEngine;
using System.Collections;
public class ChangeColorGreen_OnTrigger : MonoBehaviour
{
public GameObject Cube;
// Use this for initialization
void OnTriggerEnter (Collider Cube)
{
Cube.gameObject.renderer.material.color = Color.green;
}
}