Forum rules - please read before posting.

[BUG] CursorIcon error when changing Menu options

I'm seeing a weird problem with AC's Menu manager.
AC version: 1.51d
Unity version: 5.3.4f1


For the longest time I had a menu (Unity UI prefab) with a button that, when clicked, would crossfade to another menu. I later split those two menus up, so I wanted to change the click type to Turn Off Menu. But whenever I do that (or select any option from that dropdown), I get this error:

IndexOutOfRangeException: Array index is out of range.
AC.CursorIconBase.GetAnimatedSprite (Boolean isActive) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/CursorIcon.cs:335)
AC.MenuGraphic.SetUIGraphic () (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuGraphic.cs:250)
AC.MenuGraphic.RecalculateSize (MenuSource source) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuGraphic.cs:239)
AC.Menu.AutoResize () (at Assets/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:1166)
AC.Menu.Recalculate () (at Assets/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:1111)
AC.MenuManager.SaveAllMenus () (at Assets/AdventureCreator/Scripts/Managers/MenuManager.cs:173)
AC.MenuManager.ShowGUI () (at Assets/AdventureCreator/Scripts/Managers/MenuManager.cs:160)
AC.AdventureCreator.OnGUI () (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:258)

It does change the Click Type though, and it works as expected, but only until the next time I open that scene/project and run the game again. At that point it has reverted to Crossfade.

I get the same error when switching to the Menu tab or basically clicking any other option in there, but the Click Type thing was most noticeable since it keeps reverting.

I thought maybe it was because I don't have sprites assigned to every slot of the Cursor manager (I don't need a cursor in this game), but assigning those didn't make the error go away.

Comments

  • The error's misleading, because it's actually to do with your MenuGraphic element, rather than anything to do with your Cursor Manager.  Do you have any empty MenuGraphic elements?
  • Not as far as I can see, no. Only one menu has a graphic on it, and that one is assigned. Only thing I saw is the Pause Background is unassigned, but putting an image in there doesn't change things either.
  • I can add a NRE check easily enough to combat it, but without knowing the source of the issue it may not be enough.  From the looks of the Console message, it looks like this only occurs when editing the Menu Manager, correct?
  • Correct. As soon as it opens basically, and then whenever I change a setting.

    Of course today, after days of investigating, I go in again to test it further, and didn't get the error... but I remember having seen the error before in older versions. I never paid it any mind then since it didn't seem to have any consequences, and then after a while it seemingly went away. And well, here we are again.

    I'll see if I can find the exact reproduction circumstances, this is pretty dumb.
  • edited April 2016
    Ah, it's back.
    Not sure why - I had deleted a script that was still on a UI prefab, that threw a warning during play, and after that the error was back. I don't think it was because of the missing script, that situation never happened before. Let me know if you need any other info to debug.

    [update] Restarting Unity once again reverted the menu settings I changed just now while testing, but the error is gone again.
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.