Get adjacent objects (tiles) using Colliders?
Hi!
I'm trying to make a script for every section of cable that detects adjacent cables through colliders. I'm making it with colliders because there are mechanisms such as switchers and I think it's easier by this way to detect which path the "light" has to follow.
I've tried this code but didn't work and no gameobject is added to the List:
public class cable : MonoBehaviour {
List<GameObject> connections = new List<GameObject>();
void OnCollisionEnter(Collision col) {
connections.Add(col.gameObject);
}
}
Here you have a image of how it looks:
I hope you can help me.
sin-titulo.png
(56.6 kB)
Comment
Your answer
Follow this Question
Related Questions
2d box collider not working (have rigid body) 0 Answers
My collisions dont detect in gridbased system (check if in certain area) 0 Answers
Collision/Collider Issue? 0 Answers
How do I count Hits ?? 2 Answers