• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jul 03, 2013 at 01:26 AM by robertbu for the following reason:

Multiple technical questions.

avatar image
0
Question by BigDakaFa7 · Jul 03, 2013 at 01:16 AM · guitextcharacterwindowsscroll

How do i make my chat window save messages and be a scrolling GUI

Ok so i just made a 3d text over my character and when you type a message it pops up over their head. Now what i want to do is have that message logged in the ui we have preset on the screen as well as have the gui have a scroller so i can see old messages. All my code is working but here is what I have as of right now.

 using UnityEngine;
 using System.Collections;
 
 [RequireComponent (typeof(GUITexture))]
 
 public class ChatWindowPlacement : MonoBehaviour {
     public GUIStyle style;
     private GUITexture Image;
     private int Screen_width;
     private int Screen_height;
     public string stringToEdit = "";
     public TextMesh speechBubble;
     void Start () {
         Screen_width = Screen.width;
         Screen_height = Screen.height;
         Image = guiTexture;
         Image.pixelInset = new Rect (Screen_width / 100, Screen_height / 100, Image.pixelInset.width, Image.pixelInset.height);
     }
     
     // Update is called once per frame
     void Update () {
     
     }
     
     void OnGUI() {
         
         stringToEdit = GUI.TextField(new Rect(Screen.width /60f,Screen.height / 1.05f, 300,20),stringToEdit,25);
         if(Input.GetKeyDown(KeyCode.Return))
         {
             speechBubble.text = stringToEdit; 
         }
         if(GUI.Button( new Rect(Image.pixelInset.x + Image.pixelInset.width / 1.1f, Screen_height - Image.pixelInset.y - Image.pixelInset.height + Image.pixelInset.height/ 20, Image.pixelInset.width / 15, Image.pixelInset.height / 10) , "", style) ){
             Debug.Log("Closing Chat");
             gameObject.SetActive(false);
         }
     }
 }
 
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image iwaldrop · Jul 02, 2013 at 11:34 PM 0
Share

Please ask a question.

avatar image robertbu · Jul 03, 2013 at 01:25 AM 0
Share

There are multiple technical issues here. You need to focus your questions on a single specific technical issue. And it helps to show you've done your homework about the issue.

0 Replies

  • Sort: 

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do i take a string from a gui and show it in the gameworld c# 1 Answer

Scrolling Text 1 Answer

How do i make a TextArea Descend when messages happen 0 Answers

GUI letters number text custom 0 Answers

Gui Button Solid 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges