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 pigi5 · Jan 14, 2011 at 01:23 AM · cameradepth

Scripting for camera depth

Is there a way that I could change the depth of a camera by clicking on a button using scripting? As in, when I click a button, a camera view appears of my whole scene from above, showing where the player is relative to his surroundings. By appears, I either mean come to the front (change depth to a greater number), or literally appear (because it was invisible before). Please help.

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
0

Answer by shawnlehner · Jan 14, 2011 at 01:43 AM

pigi5,

Your question was a bit cryptic with how much you jumped around, but I assume you want to change the draw order of your camera to make it the visible camera. For this you can use the Camera.depth property, this is accesible from script.

I would recommend against this. If you are only wanting to view these cameras at certain points in your application you would be better off enabling them in these situations and keeping them disabled when you are not using them. Changing the draw order does not stop them for rendering, they are just overdrawn by other cameras.

Comment
Add comment · Show 3 · 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 pigi5 · Jan 14, 2011 at 01:48 AM 0
Share

well then could you tell me how to enable them and disable them in scripting or is it just Camera.enable and Camera.disable

avatar image pigi5 · Jan 14, 2011 at 01:50 AM 0
Share

And also could you tell me how to script for checking if I have clicked on a GUI texture or at least give me a link?

avatar image shawnlehner · Jan 14, 2011 at 05:47 PM 0
Share

To register a click on a GUITexture you can attach a script and enter your click code in the On$$anonymous$$ouseDown() method. To disable and enable the camera you simply reference the enabled property of your specified camera. You can use the static properties of the Camera class to find your specific camera, or use some of the built in object search methods of Unity.

avatar image
0

Answer by fireDude67 · Jan 14, 2011 at 04:55 AM

I would have one camera that is disabled (there is a check box next to the name, uncheck that) and then re-enabling it using disabledCamera.gameObject.active = true.

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

No one has followed this question yet.

Related Questions

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

Backgrounds moving at different speeds? 1 Answer

Problems implementing a 3rd person static camera 0 Answers

Loading pictures, how to hide and load in-game pictures? (details) 0 Answers

Can I have a 3d object or tk2d sprite between 2 NGUI layers? 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