Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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?