Forum rules - please read before posting.

Exceptions when using Unity UI + Portrait Graphics during speech

Just another issue I've stumbled upon. I'm using Unity UI to display the speaker portrait during speech lines and I got a lot of IndexOutOfRangeExceptions in CursorIcon.cs:235 - I couldn't track down why the sprites array is suddenly empty, I blame it on some internals in Unity (I stepped through the parts where the array should be created, but it never got created, so I assume some ScriptableObject magic at work here?). Anyways, the exception prohibited the rest of the UI to synchronize properly (e.g. the speech line would not be written to the text element) so I applied the following fix in CursorIcon.cs:

Everywhere a test like "if(sprites == null)" occurs, I've rewritten the test to "if(sprites == null || sprites.Length == 0)".

This solved the issue for me.

Comments

  • Thank you, I will look into this myself.
  • What version of Unity are you using?  I can't recreate this issue, and there are already checks in place to ensure the sprites array is always non-zero (see CursorIcon.233, for example).
  • I'm currently using 5.2.2p1 - I was really puzzled when the issue arose, and I really can't explain it to myself why it would happen in the first place. Maybe it is also very specific to our setup, and it didn't happen with all character portraits (We're using the action to switch character portraits very often). Maybe this should be left just for the records if someone stumbles over the same problem.
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.