Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Not able to animate the materials separately in one Mesh

Discussion in 'Animation' started by karandev11, Jan 3, 2024.

  1. karandev11


    Jan 3, 2024
    I was trying to animate my materials in one mesh using same shader but its not allowing me to do that,i am attaching a video also .
    I have 2 materials in my mesh i want to show a flow of water with that ,i am animating, my grow value(Variable in shader) with the animation but its changing for both of my materials as they are having the same shader,i tried creating a variant but that is also not working.
    In Unreal they have feature " materials instancing ",with that its possible,but here In unity ,we can only get instanced material at runtime.
    I want to animate my materials one by one ,so that i can show a flow of water from container to pipe.since meshes are using the same water shader ,i am not getting 2 variable in the property section.
    Is it a bug?
    or its not even possible in unity ?

    Attached Files:

    Last edited: Jan 4, 2024
  2. tdpl_parthpatel


    Oct 27, 2022
    I am having the same issue but am not finding a solution to this problem.
  3. gshape


    Aug 8, 2012
    write a script that have two properties :
    value0, value1
    then in script Update() takes
    meshRenderer.materials[0].SetFloat(“yourValueProperty”, value0);
    meshRenderer.materials[1].SetFloat(“yourValueProperty”, value1);

    in your animation clip, animate this script’s value0 and value1 instead