- Home /
why i'm not geting Toggle symbol when i apply fontstyle(GUIStyle)?
Hi all,
I am making a simple Examination app.
I am suffering simple problem. My Toggle symbol missed in the scene.
My code is like this:
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
private bool text1;
public GUIStyle newfont;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void OnGUI () {
GUI.Toggle(new Rect(100,100,100,50),text1,"Hi",newfont);
}
}
Can i get any solution or any help on that task.
thank you
shankar
Could you try if maybe this works:
text1 = GUI.Toggle(new Rect(100,100,100,50),text1,"Hi",newfont);
In the inspector, have you assigned newfont? $$anonymous$$aybe it's set to something that's not visible.
Try:
GUI.Toggle(new Rect(100, 100, 500, 50), text1, "Hi");
This test will use the default GUI skin & style, and specifies a wider rectangle in case the control is getting cut off.
Try adding a label (GUI.Label). Does the label show up?
I know this is an obvious one, but worth checking: Is the script attached to an active object in the scene?
Answer by ravinjfdskf · May 21, 2013 at 06:21 AM
hey ,If u are using guistyle u must have to use Toggle image to indicate its a toggle button.. so assign image in inspector n ur problem solved..
I have assign toggle image as background of that but that is not at solved. I wrote code by using textures. also. in the texture i added a toggle symbol. that also not working fine.. can i get any script reference.
Your answer
![](https://koobas.hobune.stream/wayback/20220613102520im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Projector Toggling - Scripting Problem 1 Answer
Setting render state of a GUI component 1 Answer
Toggle Enabled/Disabled script? 2 Answers
Toggle Movement Help 1 Answer