Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Assigning Materials

Discussion in 'Editor & General Support' started by Discord, Mar 27, 2009.

  1. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,002
    I was looking through the forums and documentation, and couldn't seem to find an answer to this.

    I have two similar objects that I want to share the same material. Is there a way to use a material created for one object for another object (with only one material, not duplicating that material)?

    I'm sure the answer is yes, but I simply can't figure out how to do it. It has a location for a texture, but if I add a texture, it creates a new material, and I only want to use one material between the objects.
     
  2. CoherentInk

    CoherentInk

    Joined:
    Jul 16, 2006
    Posts:
    216
    If you're using one material between two objects, it will have to have the same texture and other properties unless you modify it at runtime via scripting. Does that help?
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,254
    Note that if you modify the material of one object at runtime, Unity creates a new instance of it for you (you can see this in the "* Scene *" section of a material pop-up menu). In order to be truly shared, materials on different objects have to be 100% identical.

    --Eric
     
  4. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,002
    Ok, so I can't simply assign a material to an object.

    Shame.

    Thanks for the replies.
     
  5. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,546
    Unless I read the OP wrong, this is completely possible. Follow the material node back to the project view, where its a little sphere graphic, and drag that onto second model. Now if you mess with the texture or shader both should update.

    Im sure thats what I just read-coffee is ozmosising thru my brain as I type :)

    HTH
    AC
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,254
    Well, you can...just drag the material onto any objects you want to have that material.

    --Eric
     
  7. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,002
    gah. I'm dumb. I was trying to drag the materials onto the objects in the project folder, not the scene/hierarchy.

    thanks.
     
  8. mingway

    mingway

    Joined:
    Mar 10, 2009
    Posts:
    4
    Dear Eric

    You say:
    Well, you can...just drag the material onto any objects you want to have that material.

    Can you tell me,
    how to assign a material to multi object at ones
    I trying assign material to multi object form scene/hierarchy
    But only one effect...
     
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,254
    At the moment Unity doesn't have any built-in multi-select feature, so you have to do one at a time, unless you write some kind of editor script.

    --Eric
     
unityunity