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 Anymeese · Jan 17, 2015 at 03:31 AM · c#uitransformrecttransformrect

How to change the Top and Bottom (rect.yMin and yMax) properties of a rectTransform, in a script?

Hey guys. I made an image (with child images and buttons and what not) and made it a prefab. I am not trying to Instantiate it, however when I do, its transform info is all messed up. No problem, I can fix that manually in the code right after I instantiate it!

(NOTE: My image has the anchors at the corners of the image, NOT next to each other. That matters)

I've figured out that:

  • localPosition = how to change posZ

  • sizeDelta = how to change Left and Right

  • localScale = how to changescale

but HOW do you change Top and Bottom? I know how to READ them (rectTransform.rect.yMin and yMax), but how to I CHANGE them?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by curiouspers · Jan 24, 2015 at 01:56 PM

I think that one should help.

https://unity3d.com/ru/learn/tutorials/modules/intermediate/live-training-archive/panels-panes-windows

take a look at anchoredPosition and anchoredPosition3D, use it like this:

 text.rectTransform.anchoredPosition3D = new Vector3(my_new_x, my_new_y, my_new_z);

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

Answer by Mmmpies · Jan 17, 2015 at 09:34 AM

Not sure if this will help but it fixed an issue I had with a camera not pointing in the normal UI way, as in I have a menu that can show 3D items on Unity indy which means having a camera pointing down from the terrain. However it also deals with spells which are just prefab panels.

When I switched the new UI it was displaying them edge on! Anyway try this:

 transfrom.localRotation = Quaternion.Euler(0.0f,0.0f,0.0f);
Comment
Add comment · 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

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

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

Related Questions

Horizontal Layout Group making a Scroll Rect's Content rect width to be negative 1 Answer

UI How to configure Left And Right. 1 Answer

Revers Object Transfrom using an array problem in UI !! 0 Answers

Change size of the new UI rect transform using scripts 0 Answers

SetAsLastSibling seems to sort alphabetically when used across different objects. 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