Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


OnPostprocessGameObjectWithAnimatedUserProperties(GameObject, EditorCurveBinding[])

Called when the animation curves for a custom property of type float are finished importing.
Read time 1 minuteLast updated 10 days ago

Definition

OnPostprocessGameObjectWithAnimatedUserProperties()

public void OnPostprocessGameObjectWithAnimatedUserProperties(GameObject gameObject, EditorCurveBinding[] editorCurveBinding)

Parameters

gameObject


editorCurveBinding

EditorCurveBinding[]

Remarks

Called for every GameObject with an animated custom property of type
float
. Each animated property has an animation curve that is represented by an EditorCurveBinding. This lets you dynamically add components to a GameObject and retarget the EditorCurveBindings to any animatable property.

Examples

using UnityEngine;using UnityEditor;class MyAllPostprocessor : AssetPostprocessor{ // Increment the version number, when the AssetPostprocessors code/behavior is changed static readonly uint k_Version = 0; public override uint GetVersion() { return k_Version; } void OnPostprocessGameObjectWithAnimatedUserProperties(GameObject go, EditorCurveBinding[] bindings) { // add a particle emitter to every game object that has a custom property called "particleAmount" // then map the animation to the emission rate for (int i = 0; i < bindings.Length; i++) { if (bindings[i].propertyName == "particlesAmount") { ParticleSystem emitter = go.AddComponent<ParticleSystem>(); var emission = emitter.emission; emission.rateOverTimeMultiplier = 0; bindings[i].propertyName = "EmissionModule.rateOverTime.scalar"; bindings[i].path = AnimationUtility.CalculateTransformPath(go.transform, go.transform.root); bindings[i].type = typeof(ParticleSystem); } } }}