Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Live Color Change for SBSAR

Discussion in 'General Graphics' started by davimusprime, Apr 14, 2016.

  1. davimusprime

    davimusprime

    Joined:
    Feb 23, 2016
    Posts:
    10
    I have an sbsar with the exposed color properties.
    The sbsar is attached to a mesh and looks good.
    I wrote a script that, on button click, changes one of the colors.
    The color changes in the inspector in unity but doesn't update on the mesh in the game.
    I've tried substance.RebuildTextures(); and substance.RebuildTexturesImmediately(); but the mesh doesn't update it's color.
    I noticed in the inspector that the Albedo doesn't update either.
    Any help?
     
  2. smd863

    smd863

    Joined:
    Jan 26, 2014
    Posts:
    292
    When you make any changes to Renderer.material and that material is used by anything else, Unity will automatically clone the material. My guess is that you are updating the original material, but your mesh is now using a unique material that Unity cloned for it because you may have altered a material property at some point.

    Make sure you're updating the material that the Renderer is currently using, or make sure you always use "sharedMaterial" when you make any changes to your material to avoid cloning it (changes will affect all meshes using the material).
     
    theANMATOR2b likes this.
  3. davimusprime

    davimusprime

    Joined:
    Feb 23, 2016
    Posts:
    10
    Ugh! Thanks @CaptainScience, I figured it out. There was a checkbox "generate all outputs" that I needed to check.