Hi
I have a script associated with my Player which watches for OnRequestFootstepSounds and runs a function which raycasts to the tile underneath the player (this is 2D), finds the tag, and plays an appropriate footstep sound based on that tag (perhaps water, mud, carpet etc).
This works fine on the player.
However, when I assign the same script to an NPC, I can see that the EventManager.OnRequestFootstepSounds delegate registration is called, but the function it refers to is never called when that NPC is moved.
In my case I'm moving the NPC along a path. The NPC moves, but nothing in the function is being hit as though it's not being called. Put the script on a player, or change the NPC to a player and it works.
Can someone test that for me and confirm?
Olly
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I can't recreate such an issue.
Is this to say that the EventManager's Call_OnRequestFootstepSounds function is called, but the event isn't fired? If you can share your custom script, I'll take a look.
Hi Chris.
I have this code in a script on an NPC character. The character moves through sprite anim and in all other senses appears to move around the same as the player, albeit on a path rather than via direct movement.
The debug.logwarning line is never actioned. If I put a breakpoint on that line, then VS never shouts. The same script on the player and it works.
The two Eventmanager.onrequestfootstepsounds lines do trigger a breakpoint if I put one on them, when the object enables or disables, of course.
I don't see any issue with the code, but the same on my end works fine.
Is the Footstep Sounds component set up on the NPC in the same way that it is on the Player?