void OnCollisionEnter(Collision collider) { SpawnableObject obj = collider.gameObject.GetComponent <SpawnableObject>(); if (obj != null) { obj.CheckProjectileType(type); } }