- Home /
make scroll chat with scroll bar
here is my script it is javascript i am pretty sure it needs to be a array but i am not sure how to apply it to make my chat scroll
if you want to test it place the script on your camera
var chats = 225;
var chats1 = 190;
var chatboxw = 10;
var chatboxh = 235;
var chatboxs = 195;
var chatboxs1 = 145;
var texth = 380;
var texts = 25;
var chattextw = 225;
var enter : boolean = false;
function OnGUI()
{
GUI.Box(Rect(chatw, chath, chats, chats1), chatbox);
chat = GUI.TextField(Rect(chatboxw, chatboxh, chatboxs, chatboxs1), chattext);
textbox = GUI.TextField(Rect(chatboxw, texth, chatboxs, texts), textbox);
if(GUI.Button(Rect(chattextw, texth, 100, texts), "Enter"))
{
enter = !enter;
}
if (Input.GetKeyDown("return"))
{
enter = true;
}
}
function Update ()
{
if(enter)
{
chattext = textbox;
enter = false;
textbox = "";
}
}
You could try creating an array of chats and iterating through them, creating a new gui object for each one inside of OnGUI, to get yourself started. Then, try and make one that is pretty and more to your liking.
ok so to my understanding your saying make more GUI spots and make it go up each spot when i hit enter?
I don't know the javascript code, but something like this.
"for every string in the array
make a new GUI.TextField"
Your answer

Follow this Question
Related Questions
make it display list of the chat and a scroll bar 0 Answers
need to shorten my code but unsure of how 3 Answers
Remove Items and Item Tooltips 0 Answers
Setting Scroll View Width GUILayout 1 Answer
Javascript / Unityscript adding elements of an array 2 Answers