Remove Door's collider if cube is in the trigger,Destroy Door's Collider if box is in the trigger
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;
public class OnTriggerLoadLevelV2 : MonoBehaviour {
public GameObject enterText;
public string levelToLoad;
void Start()
{
}
// Update is called once per frame
void OnTriggerStay(Collider box)
{
Destroy(GetComponent<BoxCollider>());
}
},Before hating me, I'm not pretty good at C#. Here is my code:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;
public class OnTriggerDestroyObject : MonoBehaviour {
public GameObject enterText;
public string levelToLoad;
void Start()
{
}
// Update is called once per frame
void OnTriggerStay(Collider box)
{
Destroy(GetComponent<BoxCollider>());
}
}
Comment