Troubleshooting

As we have seen, collisions are an interplay of a lot of moving parts, from project settings, to inspector settings, script events and their fields. When something in this system doesn’t work, it usually fails silently leaving you to consider what wasn’t set up correctly. The following is a general checklist against these common points of failure.


  • Layers – Set objects to their correct layers. Remember, shot layers are determined by the emitter that fires them, and set in the emitter’s controller under “Sort Layer”. Meanwhile, objects that shots collide with are set by their physics layer in the inspector (upper right, above the transform component).
  • Layer Matrix – Make sure layers actually interact in the Layer Collision Matrix in the menu section Project Settings > Physics2D
  • Colliders / Rigidbody2D – Make sure that, both, the shot prefabs and the objects being collided with have 2D colliders. The object that collides with a bullet (the player, enemy, terrain, etc) should also have a RigidBody2D component that is properly set up.
  • Script Collision List – Set the Collision List in the Shot script or the ShotCollision/ShotCollisionDamage scripts to filter which layer produces explosions. EG: Terrain layer objects typically accepts ND_PlayerBullet and ND_EnemyBullet layer objects. Player layer objects typically accept ND_EnemyBullet layer objects, etc.
  • Explosion Name – Correctly name the explosion prefab string that is requested by these scripts. Double check by going to the GlobalShotManager and finding the correct name there.
  • Explosion Prefab – Make sure your GlobalShotManager actually has the prefab explosion set in its Explosions Prefabs list. While you’re there, also be sure you’re using the right GlobalShotManager. If you’ve placed a ForceGlobalShotManager script on your camera, you can set it as the demo version (found in the Resources > GlobalShotManager > DemoVersion folder) or your own custom one in the root folder.