Hi Chris,
I am trying to change the image of a AC menu element by script but fail, would you pls help?
I am trying to script like this:
AC.MenuGraphic test = AC.PlayerMenus.GetElementWithName ("Canvas", "CharacterPortrait") as AC.MenuGraphic;
test.uiImage.sprite = GameObject.Find("xxx").GetComponent().sprite;
I would like to replace image of an AC menu graphic with one of a sprite object in the scene by script. How can I do this? Would you pls have some advice, thanks a lot.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
You can use the MenuGraphic's SetNormalGraphicTexture function, passing in the sprite's original texture:
If you're setting this to a sprite in script, however, you may be better off not linking it to the Menu Manager as a Graphic element - and instead just affecting the Image component directly.