Animation Play Automatically#
Animation / Animation / Animation Play Automatically
Can Read
Can Write
Description#
The Play Automatically property of the Animation 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;
namespace VisualScript.Runtime
{
[Get]
[Set]
[Title("Animation Play Automatically")]
[Category("Animation/Animation/Play Automatically")]
[Description("The Play Automatically property of the Animation component")]
[Image(typeof(IconAnimation), ColorTheme.Type.Teal)]
[Keywords("Animation, Clip, Play, Animate")]
[Serializable]
public class GenTypeBool_Animation_PlayAutomatically : TypeBool
{
[SerializeField] private GetGameObject m_Animation = new GetGameObject(
new GenTypeGameObject_Animation()
);
public override bool GetPreview(GameObject source)
{
GameObject instance = this.m_Animation.GetPreview(source);
if (instance == null) return default;
Animation component = instance.GetComponent<Animation>();
return component != null ? component.playAutomatically : default;
}
public override bool Get(Args args)
{
Animation instance = this.m_Animation.Get<Animation>(args);
return instance != null
? instance.playAutomatically
: default;
}
public override void Set(bool value, Args args)
{
Animation component = this.m_Animation.Get<Animation>(args);
if (component != null) component.playAutomatically = (bool) value;
}
public override string ToString()
{
return $"{this.m_Animation} Play Automatically";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}