Just hit a fun (?) bug. Entirely my fault, but thought it worth mentioning in case you want to bolster against it!
One of my characters is an ever-present Prefab. At the start of every scene, she is created, and placed accordingly.
When loading into a specific scene, one of her subsequent voice lines would a/ not play and then b/ play when changing scenes, every time a scene changed.
Turned out that my OnLoad action script wasn't creating the character (as OnStart does), so when her RecordedConstantID wasn't found present in the scene, it was assigning the voice line AudioClip to her prefab instead. With 'play on Awake' ticked, it played every time the character was created anew.
My fault, but I feel like maybe some sort of barrier to writing data to Prefabs could possibly exist, to protect idiots like me from ourselves? ;D
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Thanks for the report.
When you say "assigning the voice line", do you mean from within the Speech Action, or is the prefab itself having its own data amended?
If the former, that's intended. The prefab itself shouldn't be getting modified, but AC will allow a non-present prefab to be used as a speaker (to allow for e.g. off-screen characters to speak without needing to go through the hassle of spawning them).
If your character is present in each scene, though, is it possible to spawn them just once when the game begins, marking them as persistent with the "Survive Scene Changes" component?
You can run a single Object: Add or remove Action when the game is run by defining a Scene / Begin game event in the Events Editor.
'Survive screen changes' wasn't really as elegant a solution as just having an Action Asset that creates the character called from OnStart, tbh, so I went with that! Means I am actively creating on scenes where I need her, rather than actively destroying/ recreating on scenes I don't, which feels cleaner?
As to the bug: yes, the prefab itself is getting amended. The assigned voice clip ("Character1234") is assigned to the AudioSource's AudioClip parameter in the prefab itself, and stays there. Seems to be consistent in builds and editor, as well?
Gotcha - thanks, I'll look into this.
Would you mind testing a fix?
To do so, open up AC's Speech script and look for the AssignAudioClip function around line 1634.
Within, replace the line:
with:
Does that resolve it?
Hello! Sorry, I forgot all about this. Ran a test this end and it seems to work, as far as I can tell