How do You add a Scrollbar in a textbox C# code
Hello I am currently working on a unity project that requires a textbox that would pop up when clicked on the game object, the problem im having is making the code i need to communicate with the c# file. 1: the code should allow the player to click on the game object that pops up a text box with a scroll bar inside and also the text that is generate can be edited by the user in the C# code. the text can only be added in the editor not the Script file. 2:the same format but without the Scollbar just editing the text in C#. Any help with this Greatly Apreciated, Below is the Script code im working on now .
public class DialogueBox : MonoBehaviour { private string myText = "You Have Arrived at your destination";
// Use this for initialization
private bool PopUp;
public string Info;
void OnMouseDown()
{
PopUp = true;
}
void DrawInfo()
{
Rect rect = new Rect (20,20, 300, 200);
Rect close = new Rect (300,20,20,20);
if (PopUp)
{
GUI.Box(rect, Info);
if (GUI.Button(close,"X"))
{
PopUp = false;
}
}
}
void OnGUI()
{
DrawInfo();
}
}
Your answer
Follow this Question
Related Questions
Connect C# script with GuiText 1 Answer
How to fix error CS0103 Cannot implicitly covert type 'bool' to 'string' 1 Answer
Instantiated in IF statement - Else Reference object 1 Answer
TextUI text changes size if resolution changes 1 Answer
Show Text where user clicks in a panel,Show text where User clicks 0 Answers