I have a menu (Unity Prefab) that contains a graphic menu element that I try to assign a texture to in runtime. I tried this:
var graphicElement = PlayerMenus.GetElementWithName("MenuName", "ElementName") as AC.MenuGraphic;
graphicElement.backgroundTexture = Resources.Load("TextureName");
And this:
graphicElement.LoadUnityUI(menu, menu.canvas);
graphicElement.uiImage.sprite = Resources.Load("TextureName");
Nothing fails at runtime (the menu element is found and the resource is loaded), but the texture isn't shown. If I set the texture in the editor, it's shown fine.
Any ideas?
Thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Assuming the element's Graphic type* is set to **Normal, call its SetNormalGraphicTexture method.
If you want total control over the texture, however, it may be worth disconnecting it from the Menu Manager and updating it directly.
Thanks!