Skip to content

Scripting

Every effect property is a normal shader property, so you drive them with Unity’s own material API. Nothing asset specific is involved.

This comes up most on materials assigned to Mesh Renderers. On Particle Systems you will usually get further with the particle system’s own modules and Custom Vertex Streams, which feed values per particle rather than per material.

Four ways, in order of convenience:

  1. From version 2.41, right click the property’s label in the Material Inspector and pick Copy property name. The name, for example _Alpha, goes to the clipboard ready to paste. Right click the label on the left: the value side keeps Unity’s own menu, which copies the value.
  2. Hover over any property in the Material Inspector. The tooltip gives the property name.
  3. Look it up on Effects and Properties Breakdown, which lists every one.
  4. Read the Properties block at the top of Assets\Plugins\AllIn1Assets\AllIn1VfxToolkit\Shaders\AllIn1Vfx.shader.
Shape Properties in the Material Inspector, with a red arrow from Global Alpha to its hover tooltip showing the property name _Alpha

Shape properties follow one rule worth knowing: Shape 1 omits the number, Shapes 2 and 3 keep it. So the shape tint is _ShapeColor, _Shape2Color and _Shape3Color.

Material mat = GetComponent<Renderer>().material;
mat.SetFloat("_Alpha", 0.5f);
mat.SetColor("_Color", new Color(0.5f, 1f, 0f, 1f));
mat.SetTexture("_MainTex", texture);

SetFloat, SetColor and SetTexture cover almost everything the shader exposes. Sliders and toggles are floats, colours are colours, textures are textures.

renderer.material creates an instance the first time you touch it, so changes affect this object alone, and that instance is yours to destroy when the object is destroyed. renderer.sharedMaterial edits the asset itself, so every object using it changes, and in the editor that change is written to disk.

Use material for a per-object effect. Use sharedMaterial when you deliberately want everything to change at once.

A worked example: dissolving an effect out

Section titled “A worked example: dissolving an effect out”

_FadeAmount drives the dissolve, from -0.1 for untouched to 1 for fully gone. Enable Fade From Noise Texture on the material, then drive the amount:

using System.Collections;
using UnityEngine;
public class DissolveOut : MonoBehaviour
{
private static readonly int FadeAmount = Shader.PropertyToID("_FadeAmount");
[SerializeField] private float duration = 1f;
private Material mat;
private void Awake()
{
mat = GetComponent<Renderer>().material;
}
public void Dissolve()
{
StopAllCoroutines();
StartCoroutine(DissolveRoutine());
}
private IEnumerator DissolveRoutine()
{
for (float t = 0f; t < duration; t += Time.deltaTime)
{
mat.SetFloat(FadeAmount, Mathf.Lerp(-0.1f, 1f, t / duration));
yield return null;
}
mat.SetFloat(FadeAmount, 1f);
}
}

Two things worth copying from that. The property ID is cached with Shader.PropertyToID in a static readonly field, which is how you should address any property you set every frame, since the string version hashes the name on each call. The asset does the same thing internally, in AllIn1VfxScrollShaderProperty. And the effect stays enabled throughout, with only its amount moving, which is the recommended pattern explained on How to Enable/Disable Effects at Runtime.

A shape dissolving with a burn edge while a label shows _FadeAmount going from -0.1 to 1

If all you need is a property that moves over time, the asset ships two components for it: AllIn1VfxScrollShaderProperty for a float and AllIn1VfxScrollShaderTexture for a texture offset or scale. Both take the property name as a string and can loop, ping pong, or stop at a value. See Helper Scripts and Other Utilities.

UI materials are shared, so every Image using the same material asset shares one instance and a change to one changes all of them. The asset ships AllIn1GraphicMaterialDuplicate.cs to make a per-Image copy on Awake. See How to Animate Materials.

A Mask or RectMask2D does not clip the VFX Toolkit’s materials: their shaders have no stencil or clip rect support, so an Image using one draws past the edges of a masked panel (seen in URP on 2026-11-02). Keep those Images outside masked areas, such as a Scroll View.

The AllIn1VfxComponent (AddAllIn1Vfx in the Add Component menu) exists to set materials up in the editor. Do not call it from gameplay code. Once your material is set up you can remove the component, and leaving it costs nothing either way.

The demo’s one-shot prefabs destroy themselves when they finish: their Particle System’s Stop Action is Destroy. To replay one from a script, set Stop Action to None and call Play() again, or spawn a new instance each time.