Forum rules - please read before posting.

Receiving an error related to a Unity UI menu linked to AC

Unity 2020.311f1
Ac 1.75.0

I have a Unity UI menu that's giving this error and preventing the scene from launching:

NullReferenceException: Object reference not set to an instance of an object
AC.MenuInteraction.CopyInteraction (AC.MenuInteraction _element, System.Boolean ignoreUnityUI) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuInteraction.cs:121)
AC.MenuInteraction.DuplicateSelf (System.Boolean fromEditor, System.Boolean ignoreUnityUI) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuInteraction.cs:105)
AC.Menu.Copy (AC.Menu _menu, System.Boolean fromEditor, System.Boolean forceUIFields) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:368)
AC.PlayerMenus.RebuildMenus (AC.MenuManager menuManager) (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:155)
AC.PlayerMenus.OnInitPersistentEngine () (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:87)
AC.StateHandler.Initialise (System.Boolean rebuildMenus) (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:121)
AC.KickStarter.SetPersistentEngine () (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:182)
AC.KickStarter.Initialise () (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:1138)
AC.MultiSceneChecker.Awake () (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:43)

Relevant images:

Everything was working when I had only 2 of the buttons linked. The issue started when I went and linked all the 12 elements.

Any ideas what it could be?


  • 12 elements as in 12 separate Interaction elements?

    As a test, open up AC's MenuInteraction.cs script, and look for the following around line 121:

    uiSlots = new UISlot[_element.uiSlots.Length];

    Replace it with:

    uiSlots = (_element.uiSlots != null) ? new UISlot[_element.uiSlots.Length] : new UISlot[0];

    Does that resolve it?

  • edited May 2022

    Thanks, that worked!

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.