swb_base/particles/ParticleCount.cs

A small component that sets the MaxParticles of a ParticleEffect on awake. It reads Min and Max properties, picks a random integer in [Min, Max], and assigns it to the ParticleEffect.MaxParticles.

Native Interop
using System;

namespace SWB.Base.Particles;

[Group( "SWB Particles" )]
public class ParticleCount : Component
{
	[Property] public int Min { get; set; }
	[Property] public int Max { get; set; }

	protected override void OnAwake()
	{
		var effect = GetComponent<ParticleEffect>();
		var max = Random.Shared.Next( Min, Max + 1 );
		effect.MaxParticles = max;
	}
}