Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 gribbly · Aug 13, 2011 at 10:59 PM · cameraeditor-scriptingeditorwindow

Setting position of editor scene camera

I'm trying to move the editor scene camera. I'm able to get the position of the camera easily enough (using a script that extends EditorWindow):

 //getting camera position works:
 if(Camera.current) {
     var sceneCameraPosition = Camera.current.transform.position;
     Debug.Log(sceneCameraPosition.ToString());
 }

But I don't seem to be able to set the camera position:

 //setting camera position FAILS silently:
 if(Camera.current) {
     var newCameraPos = Vector3(2000,2000,2000);
     Camera.current.transform.position = newCameraPos;
 }

The script reference docs say that Camera.current is read only, so am I trying to do the impossible here?

Comment
Add comment · Show 1
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 yoyo · Apr 08, 2014 at 09:15 PM 0
Share

Note that if you just want the Scene camera to follow one of your game objects, then just select the object in the Hierarchy and press Shift-F.

1 Reply

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

Answer by Julien-Lynge · Aug 14, 2011 at 05:38 AM

Voila:

http://forum.unity3d.com/threads/64920-Moving-scene-view-camera-from-editor-script?highlight=scene+view+camera

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 gribbly · Aug 14, 2011 at 11:01 PM 0
Share

Thanks NOAA_Julien - that thread is useful. I gave it a try and it does modify the scene camera - so it is possible. However the results aren't what I expected, and it doesn't appear to handle rotation (which I also want to do). But it gives me hope! I'll keep trying.

avatar image Julien-Lynge · Aug 19, 2011 at 04:46 AM 0
Share

Glad it worked for you. If this was good enough to solve your immediate question can you mark the answer as accepted so it disappears from the 'Unanswered' list?

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Show camera view in an editor window 1 Answer

Custom Editor Camera Render Cannot See Meshes 0 Answers

Unity Import Package window button callbacks? 0 Answers

EditorGUILayout.LabelField not centered properly 1 Answer

how to stop reorderable list from passing Event value to the new element 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