How do you call a function when a player walks into a cube?
ie: Triggering events
using UnityEngine;
using System.Collections;
public class FloorTileCollision : MonoBehaviour {
public GameObject target; //This is set to the disappearing wall
void OnTriggerEnter(Collider other)
{
Debug.Log("Collision works");
target.active = false;
}
void Update () {
}
}
Well here let me be more specific (a friend of mine suggested just the vague question and wouldn’t leave it alone).
I’m trying to set up a scenario where when a player walks onto a specific cube, another cube will disappear. It’s to simulate like a floor panel opening a wall, that sort of thing. Using what you mentioned above, when I play the scene it ends up disappearing anyway without the player doing anything.
You should not use Answer for this. either 'add new comment' or edit your original post. otherwise it looks like your question is getting answered and people will ignore it.
Can you post the code? You should have the script reference the other object that you want to disappear. http://unity3d.com/support/documentation/ScriptReference/index.Accessing_Other_Game_Objects.html
– DaveA