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.
 
 
 
 
 

40 lines
1.4 KiB

using UnityEngine;
using UnityEditor.VFX;
// DEPRECATED
class GetSpawnCount : VFXOperator
{
public override string name { get { return "Get Spawn Count"; } }
public class OutputProperties
{
[Tooltip("Outputs the number of particles spawned in the same frame.")]
public uint SpawnCount;
}
protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
{
return new VFXExpression[] { new VFXExpressionCastFloatToUint(new VFXAttributeExpression(VFXAttribute.SpawnCount, VFXAttributeLocation.Source)) };
}
public override void Sanitize(int version)
{
var sourceSpawnCount = ScriptableObject.CreateInstance<VFXAttributeParameter>();
sourceSpawnCount.SetSettingValue("location", VFXAttributeLocation.Source);
sourceSpawnCount.SetSettingValue("attribute", VFXAttribute.SpawnCount.name);
sourceSpawnCount.position = position - new Vector2(300, 100);
var parent = GetParent();
if (parent)
parent.AddChild(sourceSpawnCount);
var inlineUInt = ScriptableObject.CreateInstance<VFXInlineOperator>();
inlineUInt.SetSettingValue("m_Type", (SerializableType)typeof(uint));
sourceSpawnCount.outputSlots[0].Link(inlineUInt.inputSlots[0]);
VFXSlot.CopyLinksAndValue(inlineUInt.outputSlots[0], outputSlots[0], true);
ReplaceModel(inlineUInt, this);
base.Sanitize(version);
}
}