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.

Question Shared Material

Discussion in 'Visual Scripting' started by Johnbaljian, Oct 12, 2022.

  1. Johnbaljian

    Johnbaljian

    Joined:
    Jun 23, 2016
    Posts:
    42
    I have linked several objects to a shared material in Blender, so when i chane the color of the material all of the objects colors are updated. After exporting the model into unity, i wanted to change the color using such as:

    GetComponent<Renderer>().material.SetColor("_Color", Color.red);

    or

    transform.Find("Cube").gameObject.GetComponent<Renderer>().materials[0].color = Color.red;

    it only changes the color of the main object , and i have to apply the script to every child object separately, isn't there a script to change the shared texture color of the shared texture of all objects in unity?