mkrebser / GPUInstance

Instancing & Animation library for Unity3D
Other
228 stars 44 forks source link

Can I update skinnedMesh.mesh.props_color32 in runtime? #22

Open kaisunc opened 2 weeks ago

kaisunc commented 2 weeks ago
            skinnedMesh.mesh.props_color32 = new Color32((byte)255, (byte)0, (byte)0, (byte)255);
            skinnedMesh.mesh.DirtyFlags = DirtyFlag.props_Color;
            skinnedMesh.UpdateAll();
            m.Update(Time.deltaTime);

doesn't do anything. Is there another way?

mkrebser commented 2 weeks ago

Make sure that your shader is actually using the instance color. You will need to write the shader yourself.

Example shader: https://github.com/mkrebser/GPUInstance/blob/master/Assets/Resources/GPUInstance/instancemeshdefault.shader