x


Different prefabs with same mesh but different textures(materials).

I think I am missing something here. I drop a .blend file and two PNG images into an Asset folder.

I create a game object with mesh filter and renderer pointed to PNG texture #1. I turn it into a prefab and it looks good.

Then I create a new game object but this time attempt to choose PNG texture #2 on the mesh renderer.

This changes the first prefab to texture #2 as well.

Someone please point out what I am doing wrong here, as these are two different Mesh Renderers and should not be linked at all.

Unity 2.6.1

Thanks

more ▼

asked Oct 02 '10 at 06:04 PM

DavidM gravatar image

DavidM
1 2 2 2

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Materials are NOT textures. Texturing a model is a 3 step process:

Texture --> Material --> Model

This means you take a texture and use it in a Material. The Material defines not just the Texture(s) in use, but also the Shader, color, effects, UV offsets, etc applied to the model.

What you're doing is using the same material on two different objects. When you change the texture in that Material, it of course affects both models since they both use the same Material.

To fix, you need to create a new material. The easiest way is to duplicate the current one. Select the Material you want to duplicate in the Hierarchy window. Go up to the EDIT menu and click DUPLICATE. You'll now have a new Material. Rename that material and select your second texture for this material. Last step is to go to you model and select the new material instead of the old one. You'll find the Material selection in the MESH RENDERER component of your model.

more ▼

answered Oct 06 '10 at 04:58 AM

Gabriel 1 gravatar image

Gabriel 1
87 2

Thanks for the explanation. I understand that textures are not materials but was confused that 2 different prefabs were sharing the same material, I thought it was duplicated when i duplicated the game object.

Thanks again for your help.

Oct 06 '10 at 12:16 PM DavidM 1
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2203
x1364
x1258
x817

asked: Oct 02 '10 at 06:04 PM

Seen: 3646 times

Last Updated: Oct 02 '10 at 06:04 PM