If I want to change the material on an object to another one that is in my assets folder but not in my scene how do I do it?
I can do it in an editor script but I want to do it while the app is running…
If I want to change the material on an object to another one that is in my assets folder but not in my scene how do I do it?
I can do it in an editor script but I want to do it while the app is running…
You could use Resources.Load for that.
–Eric
I tried that but couldn’t get it to work.
Could you post an example?
This is what I tried
transparent = Resources.Load("Materials/transparent", Material);
In the end I set up a dummy object with the material on it and copied it from there.
transparent = GameObject.Find("Transparent").renderer.sharedMaterial;
Ugly but it worked. I’d rather do it using the resources thing.
![]()
–Eric
Has anyone found a dynamic way to assign a bunch of textures to a bunch of materials(100 objects)as opposed to doing just one?Does the code look something like this?
{for i=0;i<4;i++) {
for (j=0;j<4;j++) {
form the front face name "front %d%d" from the i,j
for the front texture name "front%d%d" from the i.j
assign them
}
Im not so hot on this stuff at this point, this is not my code and I want to know if this is the right direction to go before I try and figure this out…
thanks :roll:
AC
Ahhhhhhhh… cheers
Just to close, I got my dynamic assignment of multiple textures to multiple meshes sorted>>
I hired someone who rolls icecreams for a living to drag and drop 8000 textures onto meshes…
JK-I did get it sorted tho
AC