Forum rules - please read before posting.

Exception because of null texture in CursorIcon

edited September 2023 in Technical Q&A

Hello Chris,

not sure if it's a bug, as I updated my project on the latest LTS Unity version and the latest Adventure Creator, I'm seeing an error message in the console:

null texture passed to GUI.DrawTexture
UnityEngine.GUI:DrawTexture (UnityEngine.Rect,UnityEngine.Texture,UnityEngine.ScaleMode,bool,single)
AC.CursorIconBase:Draw (UnityEngine.Vector2,bool) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/CursorIcon.cs:666)
AC.Hotspot:DrawHotspotIcon (bool) (at Assets/AdventureCreator/Scripts/Logic/Hotspot.cs:424)
AC.StateHandler:_OnGUI () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:434)
AC.StateHandler:OnGUI () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:383)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)

I could fix it by adding:

      if (texture == null) {
        return null;
      }

to CursorIcon.cs#614.

I'm using a custom cursor, but no special Hotspot cursor:

image

Comments

  • I think I found the configuration problem on my side:

    image

    But should it result in a null pointer exception? Maybe, not... ¯_(ツ)_/¯

  • Recreated, thanks for the details.

    That's the issue, indeed - I'll see if an amendment to improve error feedback can be made.

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.