void Update() { if (!EffectMaterial || Application.isPlaying && !UpdateField) { return; } if (Tree == null) { return; } mFigures = Tree.GetComponentsInChildren <Figure>(); mFiguresCount = mFigures.Length; EffectMaterial.SetInt("_Size", mFiguresCount); var numbers = new float[64]; var parameters = new Matrix4x4[64]; var transforms = new Matrix4x4[64]; for (int i = 0; i < mFiguresCount; i++) { numbers[i] = (float)mFigures[i].Type; parameters[i] = mFigures[i].Params; transforms[i] = mFigures[i].transform.worldToLocalMatrix; } EffectMaterial.SetFloatArray("_Numbers", numbers); EffectMaterial.SetMatrixArray("_Transforms", transforms); EffectMaterial.SetMatrixArray("_Params", parameters); }