TMP Text Sprite Asset#
UI / Graphic / TMP Text / TMP Text Sprite Asset
Can Read
Can Write
Description#
The Sprite Asset property of the TMP Text 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;
using TMPro;
namespace VisualScript.Runtime
{
[Get]
[Set]
[Title("TMP Text Sprite Asset")]
[Category("UI/Graphic/TMP Text/Sprite Asset")]
[Description("The Sprite Asset property of the TMP Text component")]
[Image(typeof(IconUIText), ColorTheme.Type.Blue)]
[Keywords("UI, User, Interface, TMP, Text, Mesh, Pro")]
[Serializable]
public class GenTypeScriptableObject_TMP_Text_SpriteAsset : TypeScriptableObject
{
[SerializeField] private GetGameObject m_TMP_Text = new GetGameObject(
new GenTypeGameObject_TMP_Text()
);
public override ScriptableObject GetPreview(GameObject source)
{
GameObject instance = this.m_TMP_Text.GetPreview(source);
if (instance == null) return default;
TMP_Text component = instance.GetComponent<TMP_Text>();
return component != null ? component.spriteAsset : default;
}
public override ScriptableObject Get(Args args)
{
TMP_Text instance = this.m_TMP_Text.Get<TMP_Text>(args);
return instance != null
? instance.spriteAsset
: default;
}
public override void Set(ScriptableObject value, Args args)
{
TMP_Text component = this.m_TMP_Text.Get<TMP_Text>(args);
if (component != null) component.spriteAsset = (TMP_SpriteAsset) value;
}
public override string ToString()
{
return $"{this.m_TMP_Text} Sprite Asset";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}