- Home /
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.
Well I have it so when the player breaths in the blows out the air and a image of wind is rendered then the enemies material changes. Then the wind image fades away.
I don't think that sounds right sorry.
Answer by timsk · Oct 10, 2011 at 09:46 AM
http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=material
In particular look at Material.GetTexture and Material.CopyPropertiesFromMaterial is also usefull
Your answer
Follow this Question
Related Questions
Instantiate enemies around player 1 Answer
Rotate object around player when space is pressed. 1 Answer
Attack within 0.61 meters? 1 Answer
Player lives script 1 Answer