✅ How to reference gameObject in OnCollisionEnter2D?
I don't want to detect collision of the game object the script is tied to, I want to detect collision of an instantiated object called _cell. How do I reference _cell in the collision function?
7 Replies
Do i replace the col or gameObject with _cell, or add it somewhere?
detect the collider you are colliding with by checking the tag name then if your condition is true you can safely assume col.gameObject is your cell object
what tag does your cell have?
cellTag
check for that tag then
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.Ah yeah