Set Image Preserve Aspect#
UI / Graphic / Image / Set Image Preserve Aspect
Description#
Sets the Preserve Aspect property of Image component
Parameters#
| Name | Description |
|---|---|
| Image | |
| Value |
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
{
[Title("Set Image Preserve Aspect")]
[Category("UI/Graphic/Image/Preserve Aspect")]
[Description("Sets the Preserve Aspect property of Image component")]
[Image(typeof(IconUIImage), ColorTheme.Type.TextLight)]
[Keywords("UI, User, Interface")]
[Parameter("Image")]
[Parameter("Value")]
[Serializable]
public class GenInstructionBool_Image_SetPreserveAspect : Instruction
{
[SerializeField] private GetGameObject m_Image = new GetGameObject(
new GenTypeGameObject_Image()
);
[SerializeField] private GetBool m_Value = new GetBool();
protected override string GetTitle(GameObject source)
{
string member = TextUtils.ThemeAsKeyword("Preserve Aspect");
return $"{this.m_Image} {member} = {this.m_Value}";
}
protected override Awaitable Run(Args args)
{
Image component = this.m_Image.Get<Image>(args);
if (component == null) return Done;
component.preserveAspect = (bool) this.m_Value.Get(args);
return Done;
}
}
}