jackyyang09/Simple-Unity-Audio-Manager

Library not re-generating

omrirosen opened this issue ยท 4 comments

Hi again Jacky!

I've tested the audio manager on one scene. Works perfect. Then tried adding it to a different scene, and I get nothing when re-generating. No audio library is being built.

Under sound\music library in the component, i get an error saying "Something may have interrupted AudioManager..."

Am I doing something wrong?

Thanks again

For example, when adding a music player to the new scene, I can't choose a music file for it to play, there are no options to choose from

That's strange, there are cases where AudioManager's enum generation can be interrupted by external forces such as compilation errors in other scripts, so check the console for those just to be sure.

Otherwise, try deleting the AudioManager in the scene (or the scene itself) and adding a new one in and see if that fixes anything.

I'm not able to recreate the bug you're encountering, so if you still run into it reply with the following info so I can see what's up:

  • Your Unity version and JSAM version
  • The steps you took to recreate the bug
  • Your Audio Assets folder location as listed in the AudioManager
  • A screenshot of your AudioManager settings and if possible, your Unity editor window

It seems that the following code doesn't provide the desired behavior (in unity 2020.3.x)

Type.GetType(sceneSoundEnumName);

If in the AudioManger the following method is adopted:

public Type GetSceneSoundEnum()
{
            if (sceneSoundEnumType == null || sceneSoundEnumType.ToString() != sceneSoundEnumName)
            {
                // sceneSoundEnumType = Type.GetType(sceneSoundEnumName); => seems to currently not work
                sceneSoundEnumType = GetEnumType(sceneSoundEnumName);

            }
            return sceneSoundEnumType;
}

While using the same GetEnumType which is used in the AudioManagerEditor, I managed to get them to work again.

That method should probably best be externalized as a utility function and then used in both scripts.

Maybe that helps someone else?

Thanks for the report and fix Occuros! I'll try investigating it on my end as well