Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
3
Question by stephane · Jun 07, 2010 at 10:36 AM · rendertexturewordwrap

Is it possible to render a GUI.Label into a Texture ?

Hi

Here is the thing, I love to map word-wrapped texts on planes. It's what i do. Anytime I can do it, here I am mapping word-wrapped texts over all the planes I can find. Guess what, sometimes I even do it on cubes.

And I'd love to know how to do it with Unity.

I've been kindly advised to use a GUI.Label. Which is great because it seems to be the best way to simply format dynamic texts.

Now it's easy to capture a GUI.Text or a GUI.Texture into the Target Texture of my Camera but I have no success with a GUI.Label. Do I have to assign it to a GUI.Layer ? I couldn't find how.

thanks for your help.

Here is ho I'm creating my GUI.label

using UnityEngine; using System.Collections;

public class CreateGuiLabel : MonoBehaviour { private string myString; void Start () {

     myString  = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum";
 }


 public GUISkin gSkin;


 void OnGUI ()
 {

     if (gSkin)
         GUI.skin = gSkin;
     else
         Debug.Log ("ConfigureMenuGUI : GUI skin object missing!");

     GUI.Label (new Rect (0, 0, 200, 400), myString, "Content Text");


 }

}

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 Willyfok · Nov 16, 2016 at 04:28 PM 0
Share

I have tried it by all means, I published something in Peinados con trenzas and it has been impossible.

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by jonas-echterhoff · Jun 07, 2010 at 11:14 AM

It may require some tweaking to get right, but you should be able to get this to work, by setting RenderTexture.active to your target texture in your OnGUI call (and setting it back later).

Comment
Add comment · Show 9 · 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 stephane · Jun 08, 2010 at 11:27 AM 0
Share

Hi, I'm starting to have my GUI.label or part of it into a texture. $$anonymous$$y results are really unreliable though. For example if I do set the RenderTexture.active to my targetTexture on the first frame of my OnGUI call I end up having weird bits of unity interface in my texture. I guess this is beco$$anonymous$$g overcomplicated. Is there any plug-in of some sort that would give a little more options to the 3DText ? :(

avatar image stephane · Jun 08, 2010 at 11:57 AM 0
Share

I just found this on the forum - a sweet and simple little script that word-wrap 3Dtext: http://forum.unity3d.com/viewtopic.php?p=330943#330943

avatar image jonas-echterhoff ♦♦ · Jun 08, 2010 at 12:36 PM 0
Share

Are you restoring the RenderTexture to it's previous value after your GUI.Label call?

avatar image stephane · Jun 08, 2010 at 04:42 PM 0
Share

yes, almost there. I'm really trying to figure out the proper work flow. Here is what I do : First I create a 512x512 renderTexture to which I give the beautiful name of "capturedGUI" then in the onGUI I store RenderTexture.active in a temp RenderTexture called "oldRndT" -next line- RenderTexture.active = capturedGUI; -next line- I create my GUI.Label and finally RenderTexture.active = "oldRndT". So I do capture the GUI.label but the problem is that the position and aspect ratio of the GUI.Label into my capturedGUI texture is based on my Game Window size and aspect ratio.

avatar image stephane · Jun 08, 2010 at 04:42 PM 0
Share

I don't know how to create my GUI.Label based on the capturedGUI RenderTexture size and aspect ratio. I even tried with a second camera which had a normalized viewport rect of 512x512. I feel like these guys who are lost in a snow storm in the mountains for days and who are about to give up just a few meters from a shelter they can't see... mm.. ok .. maybe I don't ...

Show more comments

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.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Is it possible to render a GUI.TextArea into a Texture ? 1 Answer

Possible to simulate screen raycast? 0 Answers

Problem with Texture Scaling for Mobile Resolutions 1 Answer

Creating a portal/window view with rendertextures 0 Answers

Render textures doesnt exist in unity 4.7.2 0 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