Hey everyone.
I am currently planning on starting one game in Unity, but before that I would like to know:
Is it possible to make invisible objects, which would appear after enemy or player collision with it?
If it is then could someone give me any advice with it?
I know that it may be something different from other requests like making objects invisible after collision, but I need opposite thing.
Thanks in advance!
Of course, it is possible. You just disable the mesh renderer of an object that you want to make invisible and then you enable it whenever a player or an enemy collides with your object. It could look like this:
void Start() {
gameObject.GetComponent<MeshRenderer>().enabled = false;
}
void OnCollisionEnter(Collision collision) {
gameObject.GetComponent<MeshRenderer>().enabled = true;
}
Thanks a lot mate. That was what I looked for!!!