On triggered event animation parameters not working

JAMES PARKS 4 months ago in Game Creator updated 4 months ago 3

Issue:  I have create game level (FPS)(I also use the shooter module in it as well) and I have a gun prefab that I create. I created an animation for the gun's slider to move back and the slide back forward quickly for a "shot" effect. It has an animator on it. And the animation controller has two animations that I created in unity. Idle and Fire shot. I have 2 "Trigger" parameters set to transition the animations between each other. "fire" and "not fire" My player shoots just fine with the gun and everything works great.. except when I click mouse 0 it does not fire the animations. So, I placed the trigger and animation actions in a separate empty game object. I have a trigger layer, that has the on key press down (mouse 0) use actions: animate_gun. animate_gun has the actions: Animate: Animator is set toPistol_Pickupable (which is the prefab gun that is instantiated when drawing the weapon), Parameter Name is set to fire, Parameter Type is set to trigger. Then, a wait action for 0.05 secs then, Animate Pistol_Pickupable again but this time the parameter name is set to not fire and is a trigger type. Then another wait for 0.05 seconds.  When I play the scene and click the left mouse button it looks like it goes through the list of actions except for the triggers. The wait times light up but not the Animate Pistol_Pickupable(s). I tried changing the them to bools and a lot of over things, but to no avail. Any help would be appreciated. Thank you.

Unity version:
Game Creator version:

Thanks for the video James, really helped us narrow down the problem. For what I've gathered, the issue seems to be that the "Animate" Action you're using references the weapon prefab, instead of the scene game object instance. This is trying to animate the prefab, not the scene's prefab instance.

You can easily work around this by opening your gun's prefab and creating the Trigger there, instead of inside the scene (and will make things more organized).

Create a new Trigger as a child of your gun's prefab model and use the "On Shoot" Trigger. Now, reference the animator from your gun and use the same Actions as you used in the video.

Hope this helps!

Thank you Marti! I will try it out right now. :) Thank you!