Registered Custom Function Stops Working After Scene Change
Posted: Sun Aug 11, 2024 11:42 pm
Hello!
Currently dealing with a strange issue with a custom function I've registered.
Basically, it grabs a reference to the instanced Sound Manager Singleton in order to load & play a sound from the Resourced folder.
I've tested the script & confirmed that it works - but ONLY on the first scene that the DialogueManager exists in.
I figure it's happening because the DialogueManager doesn't know how to get the AudioManager when scenes change - the debug one I'm using has the Dialogue & Audio Manager exist at the same time, whereas the one in the real game only has the Dialogue Manager show up later after loading into the game. The problem is, since this is wired into the DialogueManager itself via the CustomLuaFunction info & the Dialogue nodes, I don't actually now how to 'give' the DialogueManager the AudioManager's reference again.
There's also the issue that triggering this script efect doesn't show the Debug.Log at all, so it's in this strange realm of encapsulation I can't see into to diagnose the issue.
If you could give me some direction, that would be appreciated!
Currently dealing with a strange issue with a custom function I've registered.
Basically, it grabs a reference to the instanced Sound Manager Singleton in order to load & play a sound from the Resourced folder.
I've tested the script & confirmed that it works - but ONLY on the first scene that the DialogueManager exists in.
Code: Select all
public void PlaySFX(string sfxName)
{
AudioClip sound = Resources.Load<AudioClip>($"Sounds/{sfxName}");
AudioManager.Instance.PlaySound(sound);
Debug.Log("Playing sound via lua script");
}
There's also the issue that triggering this script efect doesn't show the Debug.Log at all, so it's in this strange realm of encapsulation I can't see into to diagnose the issue.
If you could give me some direction, that would be appreciated!