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);
}
}
Finally, I solved this long time ago. I used exact coordinates instead of colitions.