Forum rules - please read before posting.

Custom Action to change menu image

edited April 2018 in Technical Q&A
Hi Chris, I have been trying to write a custom AC Action to change the image of an AC menu linked to Unity UI, but for some reason, the image doesn't seem to update.

In my code, I can capture the menu and the sprite is loaded (after fighting over resource.load for a while to get the correct syntax for the path).

Could you have a quick look into the following code to see if you can find what's wrong?

Once this works, I can share the final code with the community.


  • edited April 2018
    Try setting uiImage.overrideSprite instead of uiImage.sprite
  • Thanks Chris, this works fine. Great support as usual.

    Here's a link to the functional script for anyone who needs it.
  • You're welcome.  Such scripts are best posted on the community wiki - thanks for sharing!
  • Instance of ActionMenuImageGet couldn't be created. The the script class needs to derive from ScriptableObject.

    I get this error if I try to add the script to the actions folder.
  • Place your Action in a new folder and point to that as your "Custom Actions" folder, and make sure there's no non-Action scripts in that folder.  See the "Custom Actions" chaper of the Manual for more info on installing them.  Sometimes that error can appear, but restarting Unity can resolve it - provided the script is OK.
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.