• 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 /
avatar image
0
Question by Clarinet · Aug 07, 2012 at 09:01 PM · instantiategui text

Instantiate GUI text

Hey there, I was wondering if it was at all possible to Instantiate a GUI text just as you would a game object. Here is a JS of what works for a regular game object:

 var object : Transform;
 function OnTriggerEnter(hit : Collider){
 Instantiate(object, Vector3(3,5,7),Quaternion.identity);
 }

So, I'm kinda thinking it might be the same to perform an operation like this only with a GUI text instead of a regular 3D game object. If so, I'd really like to know how, but if not, I'd like to know that too. Thanks!

Comment
Add comment · Show 1
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 teja6595 · Jun 28, 2016 at 09:25 AM 0
Share

i try to instantiate gui text on a panel but the clone text is no displaying on the parent panel...alt text

here is the c# code which i have used.... alt text

screenshot-183.png (170.3 kB)
screenshot-184.png (2.2 kB)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ScroodgeM · Aug 07, 2012 at 09:02 PM

GUIText is a GameObject like almost all other. so you could do with it everything you could do with GameObjects. just remember that GUIText uses it's position by it's own rule to display 8)

Comment
Add comment · Show 4 · 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 Clarinet · Aug 07, 2012 at 09:10 PM 0
Share

Simply put, if it's turned off (unchecked to the left of the name), that makes it not show, but once the trigger object is touched, I'd like it to show. Is there a way to do that?

avatar image ScroodgeM · Aug 07, 2012 at 09:13 PM 0
Share

void OnTriggerEnter(Collider other)
{
    GetComponent<GUIText>().enabled = true;
}
avatar image Clarinet · Aug 07, 2012 at 09:27 PM 0
Share

Sorry, that didn't exactly work. Is it JavaScript? Where does it go? How does it apply to the GUI text?

avatar image ScroodgeM · Aug 07, 2012 at 09:31 PM 0
Share

this is C#. is method should be in script, that attached to object with trigger and guitext components

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

9 People are following this question.

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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Instantiate new third person controller at the exact point first third person controller is destroyed 1 Answer

How do i Instantiate a prefab with specific assests included 3 Answers

Unable to call another gameObject's script 4 Answers

Accessing prefabs 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges