Changing Player & Enemy Material when a button is pressed.

Hey Unity Users.

I’m trying to work out how to change the players metaral as well as the enemys one when a button “space” is pressed within a certain radius.

So what I really am saying is that I want to try and get:

The players material to change for a short period of time.
The enemys to change and stay that way.
Also creating a new material in between both the enemy and player.

Is there a possible way of doing this? I have been thing about it for a few day now and nothing I seem to come up with works.

Warm Regards
CastleForce.

What do you mean, 'in between'? Do you mean fading between two textures? You can use transform.renderer.material for the rest of that stuff, but making a material which smoothly fades between one and another texture takes a special shader.

1 Answer

1

http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=material

In particular look at Material.GetTexture and Material.CopyPropertiesFromMaterial is also usefull