- Home /
Question by
ina · Sep 14, 2015 at 02:34 AM ·
materialruntimeproceduralsubstance
Substance - How do you set the random seed of procedural material at runtime
Trying to set procedural material at runtime using:
ProceduralMaterial matshooterbase = Instantiate(matLazerShooterBase) as ProceduralMaterial;
if (matshooterbase) {
matshooterbase.SetProceduralFloat ("RandomSeed", UnityEngine.Random.Range (0, 9999));
matshooterbase.RebuildTextures ();
golazerbase.transform.Find ("BASE").GetComponent ().sharedMaterial = matshooterbase;
el.matLazerShooterBase = matshooterbase;
}
But with getting this error:
material->IsFlagEnabled (ProceduralMaterial::Flag_Clone) || m_PingedMaterial == NULL || m_PingedMaterial == material UnityEngine.Object:Instantiate(ProceduralMaterial)
(Unity 5.2.0f3)
Comment
Your answer