Image Main Texture#
UI / Graphic / Image / Image Main Texture
Can Read
Cannot Write
Description#
The Main Texture property of the Image component
Code#
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>
using System;
using UnityEngine;
using VisualScript.Icons;
using UnityEngine.UI;
namespace VisualScript.Runtime
{
[Get]
[Title("Image Main Texture")]
[Category("UI/Graphic/Image/Main Texture")]
[Description("The Main Texture property of the Image component")]
[Image(typeof(IconUIImage), ColorTheme.Type.TextLight)]
[Keywords("UI, User, Interface")]
[Serializable]
public class GenTypeTexture_Image_MainTexture : TypeTexture
{
[SerializeField] private GetGameObject m_Image = new GetGameObject(
new GenTypeGameObject_Image()
);
public override Texture GetPreview(GameObject source)
{
GameObject instance = this.m_Image.GetPreview(source);
if (instance == null) return default;
Image component = instance.GetComponent<Image>();
return component != null ? component.mainTexture : default;
}
public override Texture Get(Args args)
{
Image instance = this.m_Image.Get<Image>(args);
return instance != null
? instance.mainTexture
: default;
}
public override string ToString()
{
return $"{this.m_Image} Main Texture";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}