Source Rotation#
Args / Source Rotation
Can Read
Can Write
Description#
The Transform rotation of the Source object
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get, Set]
[Title("Source Rotation")]
[Category("Args/Source Rotation")]
[Description("The Transform rotation of the Source object")]
[Image(typeof(IconSource), ColorTheme.Type.Yellow)]
[Keywords("Self")]
[Serializable]
public class TypeQuaternionSourceRotation : TypeQuaternion
{
public override Quaternion GetPreview(GameObject source)
{
return source != null ? source.transform.rotation : Quaternion.identity;
}
public override Quaternion Get(Args args)
{
return args.Source != null ? args.Source.transform.rotation : Quaternion.identity;
}
public override void Set(Quaternion value, Args args)
{
if (args.Source == null) return;
args.Source.transform.rotation = value;
}
public override string ToString() => "Source Rotation";
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}