Question by
albinandersson · Apr 26, 2018 at 07:05 PM ·
collidersbugs
Error with colliders...disabled when not even colliding
So im working on this procedural dungeon system.... it basically instantiates a dungeon "chunk"(prefab) and i can walk on it.... but when i walk on some of the chunks and try to move over to instantiate a new one, the collider is already disabled.... here is the code.
public GameObject dungeon;
public bool canSpawn;
void Start()
{
gameObject.SetActive(true);
}
void OnTriggerEnter(Collider col)
{
if (col.gameObject.tag == "Player")
{
gameObject.SetActive(false);
Instantiate(dungeon, transform.position, dungeon.transform.rotation);
}
if (col.gameObject.tag == "walldoor")
{
gameObject.SetActive(false);
}
}
}
Comment