You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
1.1 KiB

using UnityEngine.VFX;
namespace UnityEngine.VFX.Utility
{
[AddComponentMenu("VFX/Property Binders/Position Binder")]
[VFXBinder("Transform/Position")]
class VFXPositionBinder : VFXSpaceableBinder
{
public string Property { get { return (string)m_Property; } set { m_Property = value; } }
[VFXPropertyBinding("UnityEditor.VFX.Position", "UnityEngine.Vector3"), SerializeField]
protected ExposedProperty m_Property = "Position";
public Transform Target = null;
public override bool IsValid(VisualEffect component)
{
return Target != null && component.HasVector3(m_Property);
}
public override void UpdateBinding(VisualEffect component)
{
var position = ApplySpacePosition(component, m_Property, Target.transform.position);
component.SetVector3(m_Property, position);
}
public override string ToString()
{
return string.Format("Position : '{0}' -> {1}", m_Property, Target == null ? "(null)" : Target.name);
}
}
}