Forum rules - please read before posting.

CreateHoverSoundHandler error when starting scenes (possible bug)

Hi,

I'm running into this error when I try to start certain levels on my game.

NullReferenceException: Object reference not set to an instance of an object
AC.MenuElement.CreateHoverSoundHandler (UnityEngine.UI.Selectable selectable, AC.Menu _menu, System.Int32 _slotIndex) (at Assets/Plugins/AdventureCreator/Scripts/Menu/Menu classes/MenuElement.cs:247)
AC.MenuInput.LoadUnityUI (AC.Menu _menu, UnityEngine.Canvas canvas, System.Boolean addEventListeners) (at Assets/Plugins/AdventureCreator/Scripts/Menu/Menu classes/MenuInput.cs:130)
AC.Menu.LoadUnityUI (System.Boolean addEventListeners) (at Assets/Plugins/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:409)
AC.PlayerMenus.RebuildMenus (AC.MenuManager menuManager) (at Assets/Plugins/AdventureCreator/Scripts/Controls/PlayerMenus.cs:165)
AC.PlayerMenus.OnInitPersistentEngine () (at Assets/Plugins/AdventureCreator/Scripts/Controls/PlayerMenus.cs:87)
AC.StateHandler.Initialise (System.Boolean rebuildMenus) (at Assets/Plugins/AdventureCreator/Scripts/Game engine/StateHandler.cs:122)
AC.KickStarter.SetPersistentEngine () (at Assets/Plugins/AdventureCreator/Scripts/Game engine/KickStarter.cs:182)
AC.KickStarter.Initialise () (at Assets/Plugins/AdventureCreator/Scripts/Game engine/KickStarter.cs:1138)
AC.MultiSceneChecker.Awake () (at Assets/Plugins/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:43)

I'm not using any hover audio for any of my menus and the error doesn't seem to point to any menu in particular which has me stuck on how to get rid of the error. The main difference I see in the scenes that throw this error and the one that doesn't is I have different UI menus living in the scene and they are connected to AC's Menu Manager using "Unity UI in Scene" as the Source. I still get the error when turning off the scene based UI menus before starting the scenes.

I can comment out the block of code that causes the error in the MenuElement.cs script (line 247-252) to get my game running properly but I think it would be great to resolve this error without having to do that. If anyone has any tips on what could be causing the error or how to better debug to find the issue it would be much appreciated!

I just updated my project from Unity 2018.4.30, AC version 1.70.4 to Unity 2020.3.25, AC version 1.74.5. I did a complete reinstall of AC deleting the old download package and AdventureCreator project folder then re-import, deleted my Library folder for a re-import as well.

Comments

  • edited January 2022

    This looks to be caused by an Input menu element losing its connection to a Unity Input component - or a TMP_InputField component if you're using Text Mesh Pro.

    We can get details about which menu and element are involved by pasting the following just above the offending line (MenuElement.cs:247):

    if (selectable == null) { ACDebug.LogWarning ("No selectable found for element " + title + " in menu " + _menu.title); return; }
    

    That should produce a warning in the Console message - is the menu and element it refers to linked to the correct associated UI component?

  • Thanks, Chris! Got it working by making the menu's source "Unity UI Prefab" instead of "Unity UI in Scene". Another question, is there a way to suppress the following AC warning when having a menu set to "Unity UI in Scene":

    The Menu (menu title) has its Source set to UnityUiInScene, but no Linked Canvas can be found!

    I have a few scene based UI menus living in one scene and not meant to be in other scenes and this warning creates a fair bit of noise in the console when playing in those other scenes.

    Thanks again!

  • Can you share the warning messages in full - stacktrace included?

    For a typical menu that displays this warning, what is it's "Appear type" set to, and is it unlocked?

  • edited January 2022

    Sure, Chris. The "Appear type" is set to Manual and the menu is unlocked. Here's the stacktrace:

    The Menu 'ZoomedInTut' has its Source set to UnityUiInScene, but no Linked Canvas can be found!

    -> AC debug logger
    0x00007ff61c6b8bdc (Unity) StackWalker::GetCurrentCallstack
    0x00007ff61c6bffd9 (Unity) StackWalker::ShowCallstack
    0x00007ff61d41cd9c (Unity) GetStacktrace
    0x00007ff61de65e83 (Unity) DebugStringToFile
    0x00007ff61c7702f6 (Unity) DebugLogHandler_CUSTOM_Internal_Log
    0x0000021f1ef4f39b (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    0x0000021f1ef4f2cb (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    0x0000021f1ef81591 (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object,UnityEngine.Object)
    0x0000021f489d223d (Mono JIT Code) UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
    0x0000021f489d21db (Mono JIT Code) [ACDebug.cs:35] AC.ACDebug:LogWarning (object,UnityEngine.Object)
    0x0000021f489d0f3b (Mono JIT Code) [Menu.cs:407] AC.Menu:LoadUnityUI (bool)
    0x0000021f1efb2653 (Mono JIT Code) [PlayerMenus.cs:166] AC.PlayerMenus:RebuildMenus (AC.MenuManager)
    0x0000021f1efb229b (Mono JIT Code) [PlayerMenus.cs:88] AC.PlayerMenus:OnInitPersistentEngine ()
    0x0000021f1ef7747b (Mono JIT Code) [StateHandler.cs:125] AC.StateHandler:Initialise (bool)
    0x0000021f1ef72aeb (Mono JIT Code) [KickStarter.cs:183] AC.KickStarter:SetPersistentEngine ()
    0x0000021f1ef70fe3 (Mono JIT Code) [KickStarter.cs:1139] AC.KickStarter:Initialise ()
    0x0000021f1ef5f093 (Mono JIT Code) [MultiSceneChecker.cs:45] AC.MultiSceneChecker:Awake ()
    0x0000021f179ec3f0 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    0x00007ffe24bdf1e0 (mono-2.0-bdwgc) [mini-runtime.c:2849] mono_jit_runtime_invoke
    0x00007ffe24b62ac2 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke
    0x00007ffe24b6bb1f (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke
    0x00007ff61c5fcd34 (Unity) scripting_method_invoke
    0x00007ff61c5f8011 (Unity) ScriptingInvocation::Invoke
    0x00007ff61c5f816e (Unity) ScriptingInvocation::InvokeChecked
    0x00007ff61c652946 (Unity) SerializableManagedRef::CallMethod
    0x00007ff61c5c5b74 (Unity) MonoBehaviour::CallAwake
    0x00007ff61c5c4305 (Unity) MonoBehaviour::AddToManager
    0x00007ff61c5c4d41 (Unity) MonoBehaviour::AwakeFromLoad
    0x00007ff61c6927cf (Unity) AwakeFromLoadQueue::InvokePersistentManagerAwake
    0x00007ff61c693162 (Unity) AwakeFromLoadQueue::PersistentManagerAwakeFromLoad
    0x00007ff61c6932c3 (Unity) AwakeFromLoadQueue::PersistentManagerAwakeFromLoad
    0x00007ff61c358805 (Unity) LoadSceneOperation::CompleteAwakeSequence
    0x00007ff61c359300 (Unity) LoadSceneOperation::CompletePreloadManagerLoadSceneEditor
    0x00007ff61c35a12b (Unity) LoadSceneOperation::IntegrateMainThread
    0x00007ff61c35d8c6 (Unity) PreloadManager::UpdatePreloadingSingleStep
    0x00007ff61c35e04f (Unity) PreloadManager::WaitForAllAsyncOperationsToComplete
    0x00007ff61d2a97c7 (Unity) EditorSceneManager::RestoreSceneBackups
    0x00007ff61cfcbc40 (Unity) PlayerLoopController::EnterPlayMode
    0x00007ff61cfdb11d (Unity) PlayerLoopController::SetIsPlaying
    0x00007ff61cfddf87 (Unity) Application::TickTimer
    0x00007ff61d4234d1 (Unity) MainMessageLoop
    0x00007ff61d427521 (Unity) WinMain
    0x00007ff61eab5752 (Unity) __scrt_common_main_seh
    0x00007ffe6d637034 (KERNEL32) BaseThreadInitThunk
    0x00007ffe6ed22651 (ntdll) RtlUserThreadStart

  • Thanks, I'll look into it and give it some thought.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.