Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
2
Question by ina · Dec 25, 2010 at 05:58 AM · cameraruntimecoordinatesviewport

Changing Normalized Viewport Rect Coords at Runtime?

Is it possible to change a camera's normalized viewport coords at runtime?

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
5
Best Answer

Answer by Mike 3 · Dec 25, 2010 at 06:03 AM

Yup, use Camera.rect

e.g.

Camera.main.rect = new Rect(0,0,1,1); //set the camera back to taking up the full screen
Comment
Add comment · Show 2 · 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 thesfid · Oct 08, 2013 at 03:43 PM 0
Share

I'm curious as to why I'm able to adjust the camera.rect.height value, but camera.rect.top is ready only.

avatar image Gruffy · Mar 08, 2014 at 06:55 PM 1
Share

read only`s need to have their value cached in an equivalent type. the read only value can the n be passed to the cache to manipulate it in some way. once the manipulation to the value is achieved, you can pass it back through the specified matching type. The same issues arise when trying to do this with any read only type in C# not only Unity3D. I`m willing to hedge a bet that you may have already come across this with anything based around altering something like a gameObject`s transform.position transform.position.x`s, for example, position is locked inside the read only type, we cant directly access it, so we have to cache "transform.position" to something like a vector3(or exactly like one, if you like, like). Once we have this value in the Vector3 typed cache you can obviously manipulate the positional values of each vector axis (x,y,z) as you are in control of that Vector. Once you have changed the single value you wanted to change this can then be passed back to the read only type in the same way you cached to the vector in the first place , just reversed. Anyway, no doubt I have brought further confusions using the Transform class as an example/metaphor, though the answer is still valid to your Camera class troubles. What $$anonymous$$ike 3 has written , does indeed and very simply solve your problem...as whyy would you fell more comfortable controlling the top alone over the entire rectangle?( ...just a thought...)

Take care bud and thanks for reading, hope something in there makes some sense. gruffy

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

2 People are following this question.

avatar image avatar image

Related Questions

How to resize a camera's orthoSize for an object to fit inside its rect viewport? 1 Answer

Camera position in Viewport coordinates 2 Answers

Move an object in world space on the viewport 0 Answers

How to know where camera extents are inside editor? 1 Answer

is it possible to set the view port rect at both ends 1 Answer


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