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
1
Question by Noam · Oct 14, 2010 at 02:02 PM · cameraeditorscene

Modify SceneCamera's position in script?

I'm trying to create an editor script that can change the scene camera's position. In an OnSceneGUI call I do this :

 if (Camera.current)
    {
        Debug.Log("Taking over camera " + Camera.current.name);
        Debug.Log("Cam pos " + Camera.current.transform.position);
        Camera.current.transform.position = Vector3.zero;
        Debug.Log("Took over camera " + Camera.current.name);
        Debug.Log("Cam pos " + Camera.current.transform.position);
    }

When I do this, in the log i see this :

Taking over camera SceneCamera, Cam pos (11018.4, 6246.7, 7877.6), Took over camera SceneCamera, Cam pos (0.0, 0.0, 0.0)

however, this does not happen in the next frame, and the log in the next frame shows the exact same log lines (take camera position from X to 0). So it seems like this is getting overwritten somewhere along the line.

Is it possible to do something like this?

Comment
Add comment · Show 2
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 colinf · Feb 14, 2011 at 11:44 PM 0
Share

Did you ever figure out a workaround? I'm looking to set the SceneCamera's position and orientation to those of Camera.main when the player pauses the game in the editor.

avatar image Noam · Feb 16, 2011 at 03:29 PM 0
Share

Impossible as of now :(

2 Replies

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

Answer by Eric5h5 · Oct 14, 2010 at 02:27 PM

The scene camera is read-only as far as I know.

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 Noam · Oct 14, 2010 at 03:24 PM 0
Share

So scripts such as the F button (focus on active objects) are impossible to implement?

avatar image Eric5h5 · Oct 14, 2010 at 03:33 PM 0
Share

Unfortunately yes, I think so.

avatar image Seith · Mar 13, 2013 at 01:32 PM 0
Share

I've just posted a question related to the scene camera (http://answers.unity3d.com/questions/416008/problem-accessing-the-scene-camera.html).

How would you go about querying its transform information? In Unity 4 the "Camera.current" method always returns "null". Even when the game is launched while the scene view is active.

Since your question was asked about 3 years ago, I'm hoping things have changed a bit...

avatar image
0

Answer by MediaGiant · Mar 01, 2014 at 11:49 AM

http://www.olivereberlei.com/517/wrestling-with-the-editor-camera-in-unity/

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

2 People are following this question.

avatar image avatar image

Related Questions

Unity Scene View's right-click + WASD doesn't look 3D anymore? 2 Answers

Changing master view move speed. 3 Answers

How can I make a custom 3d editor within the Unity editor? 1 Answer

'Locking' a scene cam in editor? 0 Answers

How do I take a high quality screen shot from my scene view camera? 5 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