- Home /
How to edit text
I have a 2D game with some text. After a moment I load a picture on the text. Problem is, I use GUI.Label and the text have more depth than my load picture. I could'n hide the text and show the picture, because I need both at the same time. I could set depth position (the third dimension), but I am not sure, if it is possible for GUI.Label. Is it?
I also have tried 3D Text Mesh, but there I don't know how to set width. I don't want it for full screen, but just for some area. Please, what should I do for solve my problem?
EDIT: Let say, I have a image with a text (the text is in GUI.Label). For example like this: GUI.Label (Rect (25, 25, 100, 30), "Label");
And a background (the background is a texture with texture)
It can look like this: (GUI.Label and a image)
But my problem is, I need set more depth for my image (GameObject with texture)
But I don't know, if it is possible to set depth for GUI.Label text?
Or, I can do it with a 3D Text Mesh, but I need it in a area. And I don't know, how I can set width for 3D Text Mesh.
My two questions are? 1. How can I set a depth for GUI.Label text? 2. Is it possible to set width for a 3D Text Mesh?
I hope you understand me now.
I don't really know what you're asking here, it's rather incoherent. Post all relevant code and a screenshot and you are more likely to get useful help.
I dont understand what your saying. You say that you want a picture in front of your text, but you dont want to remove the text, but the text is covering your picture so you want to temportarily remove it. Is this correct? Do you want your text to be visible while the picture is up?
Just make the text mesh and scale it on the x axis to adjust the width.
You can adjust the scale in the object's transform in the properties panel
@99andy : I guess that, you want to display a text on the image? clarify your need.
GUI elements are drawn in the order they're called in the script.
GUILayout.Label("I'm hidden");
GUILayout.Label(texture); //will be drawn on top of the label
GUILayout.Label(texture); //will be drawn behind the label
GUILayout.Label("I'm on top.");
Answer by Artaani · Sep 27, 2013 at 10:44 AM
You can just setup your texture in GUI Skin or Style, for examle:
public GUIStyle MyStyle;
void OnGUI () {
GUI.Label (new Rect (0, 0, 200, 200), "Hello", MyStyle);
}
Then, in the inspector open MyStyle and set you own texture for normal, hover, active, etc. states.
Your answer
Follow this Question
Related Questions
Fitting a box collider to 3D text perfectly 1 Answer
Text Mesh Pro: highlight all words in a link 0 Answers
How to implement Text Mesh text wrapping? 2 Answers
make line Indicator invisible 1 Answer
Line Break on text mesh not working? 1 Answer