- Home /
toggle button pproblems
var ren : Renderer; // renderer material var male : Texture2D; var female : Texture2D; var a1 = 0; var myskin : GUISkin; var togglemale : boolean = false; var togglefemale : boolean = true;
function OnGUI () { GUI.skin = myskin; togglemale= GUI.Toggle(Rect(Screen.width*(4.1/6.55),Screen.height*( (4.7/6.3),Screen.width*(1.3/6.55),Screen.height*(.5/6.3)),togglemale,"MALE"); togglefemale = GUI.Toggle(Rect(Screen.width*(4.1/6.55),Screen.height*(5.7/6.3),Screen.width*(1.3/6.55),Screen.height*(.5/6.3)),togglefemale,"FEMALE");
if (togglemale== true) { ren.renderer.material.mainTexture = male; Debug.Log ("mmm"); }
if (togglefemale== true) { ren.renderer.material.mainTexture = female; Debug.Log ("fff"); }
}
i am new to unity my probelm is i am using a gui.toggle button named as MALE and FEMALE my need is when i select Male button male texture should display when i click FEMALE button female texture should display. But toggle button is not working properly .I have used renderer as cube
robert don't repeat the same question: http://answers.unity3d.com/questions/39622/toggle-button-problem , you put the same question and you already have an answer in the other question, if something is wrong you need to comment in the answer and says that it doesn't works.
Right, don't ask two times the same question and use search before asking new questions. And by the way, take a look into the FAQs http://answers.unity3d.com/faq
i want both male and female toggle button so kindly help to sole this
that answer does not work for me i want both male and female toggle button to work simultanseouly
so in that answer you can comment that you want to use the both, but when there this kind of problems you don't have to put the same question.
Your answer
Follow this Question
Related Questions
SetActive(true) is working, SetActive(false) not 2 Answers
Toggle Group on Instantiated Toggles? 0 Answers
Toggling through music 1 Answer
GUI window popup button 1 Answer
C# MOUSE EVENT TOGGLE 1 Answer