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
0
Question by BenouKat · Feb 05, 2015 at 05:01 PM · textcomponent4.6anchor

UI 4.6 : Anchor to dynamic text ?

Hi everyone.

I'm trying to anchor a UI component in 4.6 to the END of a text. I can anchor it but into the text square (right, bottom, top, left), but of course it doesn't move when the text change, cause the square never resize.

So how can I anchor a UI Component to the end of a text ?

IF NOT, may be you can help me find another solution : i'm trying to display a text like this : "Laboratory level 10". The "Laboratory" part has a big font size, and the "level 10" has a small font size. So I can't put them into the same Text component if I want two different font size, right ? That's why i'm trying to anchor "level 10" to the end of "Laboratory".

Did some one got an idea to achieve this ?

Thanks a lot.

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

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Mmmpies · Feb 05, 2015 at 05:08 PM

Can't you just set Align in the Laboratory to right?

So the end of the, presumably room name, is always next to the level number.

Align

EDIT

Thought you probably had too much Karma to not thought of that but you never know.

Try adding Content Size filter and set Horizontal to Preferred Size and it should re-size the RectTransform of the Text to fit the text inside it. Set the pivot to the middle left so it always grow out to the right.


align.png (2.0 kB)
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 BenouKat · Feb 05, 2015 at 05:13 PM 0
Share

Nope, the "Laboratory" part needs to be align to the left in my UI, so this trick can't work :)

But thanks !

avatar image BenouKat · Feb 06, 2015 at 07:56 AM 1
Share

EDIT : Never know of Content Size Fitter, it was exactly what I looking for ! I'm pretty new with 4.6, I used NGUI before, so that's why I'm asking maybe "obvious" question. And Google didn't help much this time.

Thanks !

avatar image Mmmpies · Feb 06, 2015 at 08:41 AM 0
Share

That's O$$anonymous$$ @Benou$$anonymous$$at and thumbs up for taking the time to come back and change the answer. Pivots are also really important for the new UI, they can drastically change the way panels react to size or content changes.

Get on YouTube and check out Richard Gubb's Unity videos, he does a lot of clever stuff with the new UI.

avatar image BenouKat · Feb 06, 2015 at 08:48 AM 0
Share

Thanks I will :)

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

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

Related Questions

Gui text component on an object not showing up? 0 Answers

4.6 UI Text rect does not expand automatically 2 Answers

All Text Components drawing text higher after update to 5.3 2 Answers

How to change the text of a Button with C# in 4.6 4 Answers

Text blurred: uGUI 4.6 9 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