|
I made a menu for a small Unity game but I have a small something I would like to add, The problem is I don't know how to. Basically what I want to achieve is to have buttons on my score history page in the menu that will change the texture of the page itsself, this because we have 4 tracks (yes its a race game) and I don't want to have to make 4 score history levels. So is there someone who can help me to do this?
(comments are locked)
|
|
The simple way to implement this is to create a public reference to a Texture2D and assign it the texture you want in the Inspector. From there when you want to change your texture you just have a reference to the GUITexture you want to swap textures of and assign the new texture using this:
Cheers, == Great, I'll be sure to try it today, Btw do I need to change ''myNewTexture2D'' into the name of the particular texture? Since else how will unity know what texture to change in? Thanks for helping this will make my menu look even better.
Jun 04 '10 at 05:08 AM
Najrax
I am not really good at scripting so hoping you can help me with this one. Error: BCE0005: Unknown identifier: 'myGUITexture'.
Jun 04 '10 at 06:48 AM
Najrax
"myGUITexture" is a variable you would create. Try adding the line public var myGUITexture:GUITexture in your javascript class and then through your Inspector assign the GUITexture you want to be able to swap.
Jun 04 '10 at 02:24 PM
equalsequals
(comments are locked)
|
