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

Resolved Changing float on multiple mesh renderers / materials from a list?

Discussion in 'Visual Scripting' started by tenton3d, Feb 28, 2022.

  1. tenton3d

    tenton3d

    Joined:
    Feb 28, 2022
    Posts:
    5
    Hi there!

    I have some mesh renderers set in a list, that I want to get the materials from, then change a float on the materials at the same time.

    So in my image you can see I can grab one item from the list, get the material, and change the desired float. I just cant work out how to do this on all the list items at once.

    https://gyazo.com/10bd979adb9f0ec8684639cc7ef9899c

    I've tried so many different combo's of nodes to try. I'm hoping someone can point me in the right direction.

    Thankyou
     
  2. ericb_unity

    ericb_unity

    Unity Technologies

    Joined:
    Nov 24, 2017
    Posts:
    167
    If all mesh renderers have only one material, you can do it like this. Replace Start with what should trigger the action and if you want to do anything else after itterating on all mesh renders, simply continue your flow on the Exit port.
    upload_2022-2-28_16-18-59.png
     
    tenton3d likes this.
  3. tenton3d

    tenton3d

    Joined:
    Feb 28, 2022
    Posts:
    5
    Ahh thankyou so much! Perfect
     
    ericb_unity likes this.