- Home /
I don't think I get collision box, can someone help?
Ok, so I wanna make a chunk-based system to load menu objects so I don't have to have too many objects loaded offscreen. The solution I came to was that I should have a collider extend outside of the camera and have the objects be given names in numerical order, then any time the camera collider hits the collider on the last object spawned it spawns in the next set of objects. To test this I put the collider on both the camera and the prefab of the items to be spawned it and set it to send a message in the console if it noticed they were touching using this script.
void OnCollisionEnter(Collision icon)
{
iconNumber = Convert.ToInt32(icon.transform.name);
if ((iconNumber + 1) % objectNumber == 0)
{
Debug.Log("Hello");
}
}
but I get no such message.
Any suggestions? Please explain in detail why I am dumb.
Your answer
Follow this Question
Related Questions
2D box colliders not touching but are colliding, how to fix? 0 Answers
Instantiate 1 object after 2 objects collide. ( C# ) 1 Answer
I cannot collide with a dynamically made BoxCollider2D 1 Answer
OnCollisionEnter not triggering when two rigidbody collide via Instantiate 1 Answer
Using OnControllerColliderHit and Instantiate to pick up objects but... 2 Answers