Skip to content

Commit 0a6c75c

Browse files
Allow Set Spawn Count & Set Spawn Time
TODO : List Spawn count in available variant
1 parent ad2feb1 commit 0a6c75c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

com.unity.visualeffectgraph/Editor/Expressions/VFXAttributeExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ struct VFXAttribute
9898
internal static readonly VFXAttribute StripAlive = new VFXAttribute("stripAlive", VFXValue.Constant(true)); // Internal attribute used to keep track of the state of the attached strip (TODO: Use a number to handle more tha 1 strip)
9999

100100
public static readonly VFXAttribute[] AllAttribute = VFXReflectionHelper.CollectStaticReadOnlyExpression<VFXAttribute>(typeof(VFXAttribute));
101-
public static readonly VFXAttribute[] AllAttributeReadOnly = new VFXAttribute[] { Seed, ParticleId, SpawnTime, ParticleIndexInStrip, SpawnIndex, StripIndex, ParticleCountInStrip };
101+
public static readonly VFXAttribute[] AllAttributeReadOnly = new VFXAttribute[] { Seed, ParticleId, ParticleIndexInStrip, SpawnIndex, StripIndex, ParticleCountInStrip };
102102
public static readonly VFXAttribute[] AllAttributeWriteOnly = new VFXAttribute[] { EventCount };
103103
public static readonly VFXAttribute[] AllAttributeLocalOnly = new VFXAttribute[] { EventCount, ParticleIndexInStrip, StripIndex, ParticleCountInStrip };
104104

com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Spawn/VFXSpawnerSetAttribute.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77

88
namespace UnityEditor.VFX.Block
99
{
10+
class AttributeProviderSpawner : IStringProvider
11+
{
12+
public string[] GetAvailableString()
13+
{
14+
return VFXAttribute.AllIncludingVariadicExceptWriteOnly.Concat(new[] { "spawnCount" }).ToArray();
15+
}
16+
}
17+
1018
[VFXInfo(category = "Attribute", variantProvider = typeof(AttributeVariantReadWritableNoVariadic))]
1119
class VFXSpawnerSetAttribute : VFXAbstractSpawner
1220
{
13-
[VFXSetting(VFXSettingAttribute.VisibleFlags.InInspector), StringProvider(typeof(AttributeProvider))]
21+
[VFXSetting(VFXSettingAttribute.VisibleFlags.InInspector), StringProvider(typeof(AttributeProviderSpawner))]
1422
public string attribute = VFXAttribute.AllReadWritable.First();
1523

1624
[VFXSetting(VFXSettingAttribute.VisibleFlags.InInspector)]
@@ -20,6 +28,8 @@ private VFXAttribute currentAttribute
2028
{
2129
get
2230
{
31+
if (attribute == "spawnCount") //spawnCount isn't listed in attribute but it belongs to attribute in spawner.
32+
return new VFXAttribute("spawnCount", VFXValueType.Float);
2333
return VFXAttribute.Find(attribute);
2434
}
2535
}

0 commit comments

Comments
 (0)