i want my character to use the punch animation on colliding with the player but its not working this is the script
Myself is the main object which have this trigger so i set this boolean function that if it will collide with the player the boolean will be 1 and in the update function i used this boolean function to run the animation on the main Object.
its not working. whats wrong in it?
OK, this script needs a bit of cleaning up. First of all, don't use CompareTag, just look for other.gameObject.tag and determine if it's "Player". Second of all, you will instead want the object with the "Player" tag to have isTrigger checked. Third of all, you don't need to specify the gameObject your script is attached to, because the compiler defaults to it if a specific object is not given. Therefore, your "Myself" variable is redundant. Also, you should try using camelCase for variable names so that they show correctly in the inspector. So like this:
I believe that should work. By the way, attackOrNot isn't a boolean, it's an int. :P
Hope that helps, Klep