- Home /
Character selection system help script
Character selection system help:
So I need help with the system for selection of characters.
in the first image you see is the screen of choice of characters.
in the second picture you see is when I press the button face naruto,i need change texture with a red texture,is simultaneously to come out Naruto as Gameobject, is his name as gameobject or GUItexture.
in the third picture shows that when I press a new character must again set the texture face naruto normal, it must come out the new player, as selected in this case gaara.
i hope that anyone can help me
thx for the reading Senluc.
Answer by G_Sacristan · May 29, 2011 at 12:15 PM
i thought i understood what U want;
My way to change texture is
var inactive: Texture2D;//inactive texture
var active: Texture2D;//active texture;
var defaultChar:boolean;
private var active:boolean=false;
function Start()
{
if(defaultChar)
{
guiTexture.texture=active;//if u want to start with a default character... just press check in inspector
active=true;
}
else
{
guiTexture.texture=false;//if u want to start with a default character... just press check in inspector
active=false;
}
}
function OnMouseUp()
{
if(!active) guiTexture.texture=active;
if(active) guiTexture.texture=inactive;
}
attach this script to each object with guiTexture attached
PS. if u want to do it on iOS then use HitTest in Update function.
I have got some errors about "private var active" because is been used for " var active: Texture2D;//active texture;" Unity say me that "active" is already has a definition for active. btw if i change the name active with another one,i've got a boolean error from "function Start". that is all. but thx for answer
Your answer
![](https://koobas.hobune.stream/wayback/20220612091641im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Char select / GUI button question. 3 Answers
Selected object into next scene? 3 Answers
How to get component of any button that is clicked? (Using same function for every button) 2 Answers
GameObject.Find("In-Game-Object") Position 3 Answers
Unity Crashes when C# script with code inside class but outside function is added to a GameObject 1 Answer