In script, C# specifically, is it possible to change the image of a GUI Image control. If so how? I’ve tried to change the IBrush of the control but it seems like textures and materials can’t be cast to an IBrush. What would i need to change if it’s possible?
I’ve also tried looking at the docs, there’s some help but i didn’t see anything about creating / modifying UI controls that use images.
IBrush is just interface for different brush types. For example, TextureBrush draws brush with a texture.
Example:
public class MyScript : Script
{
public UIControl Image;
public Texture Tex;
public override void OnStart()
{
Image.Get<Image>().Brush = new TextureBrush(Tex);
}
}