agelvik
New Member
Posts: 3
Posts: 3
|
Post by agelvik on Mar 20, 2023 13:25:14 GMT
Hello, Using Playmaker, I'm trying to play & attach sound on a gameobject in LateUpdate, however I'm uncertain how I would achieve that. I tried adjusting the code in Playmaker action "Master Audio Play Sound", but couldn't get it to work. I'm able to get the sound to play in lateUpdate once, however when I use Attach To Game object, it seems to use OnUpdate.
Any ideas on how to solve this?
Cheers, André
|
|
|
Post by DarkTonic Dev on Mar 20, 2023 14:14:47 GMT
Under Advanced Settings on the Master Audio game object, expand the Audio Listener Settings section and there's a dropdown for Variation Update Method. The default should be "Late Update". The only other choice is Fixed Update, for physics objects I believe. So it probably is using Late Update already. That's not when the sound is played, but when the game object that plays the sound "follows" the object playing the sound. There is no control over when the sound plays. Why would you need to play the sound during LateUpdate? It would be heard at the same frame either way I believe. Late Update just runs after Update but during the same frame.
-Brian
|
|
agelvik
New Member
Posts: 3
Posts: 3
|
Post by agelvik on Mar 20, 2023 14:34:51 GMT
Ah ok, so the update mode can't be adjusted for each sound call then, it's a global setting for every sound?
I need the sound to follow an animated spine joint, it's using procedural animation. Right now the follower is getting the default position of the joint, but not the procedural position, so the sound is appearing at the wrong spot. Lateupdate should normally fix this issue. I see the settings is already set to LateUpdate, so if the follower still doesn't get the correct procedural position, then it's a bit odd.
The sound is set to attach to a gameobject, which is parented to the joint. Could there be some kind of conflict going on with this setup?
|
|
|
Post by DarkTonic Dev on Mar 20, 2023 14:38:07 GMT
The wording in the UI is "attach" but it really "follows" as I said. If you actually attach, you get into unsolvable problems when the object you attached to gets destroyed. It used to be this way many years ago but I eventually fixed it by doing "follow".
If that didn't answer your question, then I may not understand?
-Brian
|
|
agelvik
New Member
Posts: 3
Posts: 3
|
Post by agelvik on Mar 20, 2023 14:46:31 GMT
|
|
|
Post by DarkTonic Dev on Mar 20, 2023 15:36:18 GMT
The follower will be set every frame to the exact position of the Game Object that is playing the sound. You may be playing it from a parent or something. If you need to create a child game object or move your script onto a child game object, that would be the fix. I don't really know anything about 3d objects and joints.
-B
|
|