• 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 Jan 28, 2015 at 12:18 AM by Ujean917 for the following reason:

I gave up on the attempt.

This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Ujean917 · Jan 26, 2015 at 12:45 AM · c#collision

How to create GUI Text Box during "In Game Events"?

Let me clarify that when I used the word Event I didn't mean event in the unity.engine, but event as in just a special occurrence that happens in video games, such as the Star Fox text.

I am really confused about how to write this code. How I imagine this to work is once the parent game object (that has the collider) of the player's character reaches to another invisible box with a box collider in the map and make a GUI text box with text on the screen at the bottom, just like Star Fox, and disappear after a set amount of time has passed so that the player has time to read.

So the hierarchy would look like this to help visualize:

Player Plane (Has Box Collider)

  • Player Character (Is Child of Player Plane)

The Game Plane (Is just the level)

  • Invisible Box(es) (Is Child of The Game Plane, Each Has Box Colliders set to IsTrigger)

I would also like there to be an image to the left sometimes when enemies have something to say such as bosses, like Star Fox.

Here are two scripts that I will have communicate with each other that I have so far trying to make this happen:

The first one that detects the collision.

 using UnityEngine;
 using System.Collections;
 
 public class Wave0TutorialEventManager : MonoBehaviour 
 {
 
     public string collisionTagPlane = "PlayerPlane"; //The Player Plane Game Object
     private GameObject cameraGUI;  //The camera that will show all the text Boxes
 
     void Start()
     {
         cameraGUI = GameObject.FindGameObjectWithTag ("TextBoxCamera");
     }
 
     //There will be more of these for each individual boxes, should they each have their own individiual name?
     void OnTriggerEnter(Collider col)
     {
         if(col.tag == collisionTagPlane)
         {
             //Send messages to specific gui text boxes to become active
             cameraGUI.SendMessage();
             Debug.Log ("Player Area has reached this point");
         }            
     }
 }


The Second one that enables certain GUI Text to be active.

 using UnityEngine;
 using System.Collections;
 
 public class Wave0TutorialGUIEnabler : MonoBehaviour 
 {    
     //There will be more of these for each individual dialogue
     void A Method Name (bool Status) 
     {
         //Some code here to make GUI text boxes to show up
     }
 }

I would MUCH rather have all the boxes that would activate a Text Screen to all be in this script for orderliness reason.

Sorry if this is a lot to read and if you need clarification on something I'll try to make it clearer.

If people could give me advises on how the code could be rearranged or whatnot that would be awesome. I'll continue to fiddle with the codes to see what happens and put up updates if I make breakthroughs.

Comment
Add comment
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

1 Reply

  • Sort: 
avatar image
0

Answer by Derek-Wong · Jan 26, 2015 at 03:55 AM

I don't know how to write the code in GUI, but i know how to do this in 4.6UI, so i will give you sone ideas on this and you can think if you woukd like to try it with the new ui.

I will do it in two ways:

  1. instantiate a panel prefab when u want it appear, and destroy it when u want it disappear, remember to set its parent to the Canvas

  2. use SetActive(false) to disable it initially and SetActive(true) when you want to show it.

you might need to read some 4.6ui tutorial first~sorry if i misunderstand anything~

Comment
Add comment · Show 1 · Share
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 Ujean917 · Jan 26, 2015 at 05:27 AM 0
Share

That's fine. I'm using the older version of unity at my college and they haven't upgraded it yet. I don't want to convert the project to a newer version and worry about it not being compatible with the school's version so I'll stick with what I got. Thanks for trying to help.

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

19 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 avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Collision on specific Frames 1 Answer

OnCollisionEnter for translating gameObjects? 2 Answers

How to detect collision on only one side of an object? [C#] 4 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