#How can i find if a colliding GameObject has the script i am searching for?
1 messages · Page 1 of 1 (latest)
In OnCollisionEnter2D(Collision2D col),
if (col.gameObject.GetComponent<TargetScript>() != null)
thanks
If you want to use the same component in case it exists, you could use TryGetComponent instead