just to know more about the object, does the object that contains this script has a collider and marked as trigger ?, if that, make sure the collider is big enough to handle the enemy physics.
remember the object is entering to the trigger must to be characterController or Rigidbody or trigger will not work, (i guess as an enemy it has physics), check the collision detection (in case of rigidbody) setting up from discrete to continuous.
if even this does not works, uncomment the OnGUI function so the OnTriggerEnter will be alone… ím really not sure if both functions can works together in the same script …
if that does not work yet, we could talking about bug… :\
EDIT : forgot to say you… have you tried to replace the tag with name ? :
if (otherObject.gameObject.name == "gameObjectName")
so, i guess it could be a kind of bug, … if your scene is charged of objects, try the same thing in a new empty scene, that is what i do generally if weird things happens, i discard the bug instance with this…
I’ve tried every thing I could- as far as I know anyway-
I find it hard to believe that it just doesnt want to work- I am using the same code for the projectile collision and the score and all that works fine-
Make sure that your enemy is tagged as “Enemy”, and check the spelling in all places. Check that either it or the player’s collider or the enemy’s collider is marked as trigger. Make sure that one of the objects has a rigidbody attached (collisions cannot happen without a rigidbody).
If all of those things are true, make sure that the collision is hitting (Put a Debug.Log(“Collision”) inside the trigger, but outside any if statements. If it is colliding, then it is a problem with your enemy and you need to make sure the tag is proper. The above suggestion of changing it to otherObject.gameObject.tag==“” may help.
If the collision ISN’T happening, then make sure that the colliders are actually making contact. Make them very large just to test it, and it might help to turn the Time.timeScale down to 0.1 or something so that you can watch it in slow motion.
Those would be my debugging steps in your situation. Hope that helps