As shown in the image, I created a GUI Material and assigned it to the Material property of a UIControl Image. Now, I don’t know how to access this Material via code in order to manipulate its parameters.
public class ImageCtrl : Script
{
public UIControl ImageFillTest;
[Range(0, 1)]
public float Fill;
public override void OnStart()
{
TrySetImageFill(Fill);
}
void TrySetImageFill(float fill)
{
var img = ImageFillTest.Get<Image>();
if (img == null) return;
// img.Material ?
}
}
Additionally, I’d like to achieve an effect similar to Unity’s Image Fill. Is this the correct approach?
