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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Chaosgod_Esper · May 24, 2014 at 06:22 PM · cameraeditorsceneviewsceneview

Setting the SceneView View Angle/Position?

Hi there.. I Want to write my own Tilemap Editor.

Now i need the Scene View to show the Map as i want: Orthographic, Topdwon, with a Camera Y position of 256.

I managed to do the Rotation and orthographic.

Now..:

  1. How can i change the position of the Scene View Camera, to show my Map Topdown. Means.. On Y position 256? It would be enough to set the Scene View to it´s "TOP" Setting from the Scene Gizmo..

  2. How to Set this options (including rotation and orthographic), everytime it gets changed? Cause OnGUI and OnSceneGUI only refresh the code, when clicking on them ._.?

I´m hoping for some answers :)

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
1

Answer by Alexphauge · Nov 27, 2014 at 02:49 PM

Hey there,

A very late answer, but I was looking for something similar myself. Now I've found it I'll share the solution so someone else might find it and benefit from it.

In my case I wanted the gameObject to stay selected while holding down CTRL/Control and even though I left clicked in different places in the sceneview, I also wanted to go into my "edit" mode while holding down CTRL.

     private void OnSceneGUI()
     {
         Event e = Event.current;
 
         // We're holding down CTRL
         if (e.control)
         {
             // Used to change inspectorGUI
             _holdingControlDown = true;
 
             // Makes sure to save the current camera position, rotation and orthographic setting
             if(_cameraPositionBeforeEditMode == Vector3.zero)
             {
                 _cameraOrthoBeforeEditMode = SceneView.lastActiveSceneView.orthographic;
                 _cameraRotBeforeEditMode = SceneView.lastActiveSceneView.rotation;
                 _cameraPositionBeforeEditMode = SceneView.lastActiveSceneView.pivot;
 
                 Vector3 newPivot = new Vector3(
                     accessableGridRef.transform.position.x,
                     accessableGridRef.transform.position.y + 100f,
                     accessableGridRef.transform.position.z);
 
                 SceneView.lastActiveSceneView.pivot = newPivot;
             }
 
             // Removes the default "handle" from Unity's tools
             if (Tools.current != Tool.None)
             {
                 _lastTool = Tools.current;
                 Tools.current = Tool.None;
             }
 
             // If the user holds down ctrl while clicking with left mouse button
             if (e.isMouse && e.button == 0 && e.type == EventType.mouseDown)
             {
                 Debug.Log("Pressed left mouse button while holding ctrl");
 
                 // I'm going to change some stuff here later.
             }
 
             // Set camera to iso from top point
             SceneView.lastActiveSceneView.orthographic = true;
             SceneView.lastActiveSceneView.rotation = Quaternion.Euler(90, 0, 0);
             // You can also set position here by going:
             // SceneView.lastActiveSceneView.pivot = new Vector3();
 
             // Keep selection of Level, no matter what I click in the sceneView
             Selection.activeGameObject = accessableGridRef.gameObject;
 
             // If we let go of CTRL, remember to debrief everything and put stuff back to "normal"
             _debriefEditorMode = true;
         }
         else
         {
             // Resets everything back to the view it had before
             if (_debriefEditorMode)
             {
                 _holdingControlDown = false;
 
                 if (Tools.current == Tool.None)
                 {
                     Tools.current = _lastTool;
                 }
 
                 SceneView.lastActiveSceneView.rotation = _cameraRotBeforeEditMode;
                 SceneView.lastActiveSceneView.orthographic = _cameraOrthoBeforeEditMode;
                 SceneView.lastActiveSceneView.pivot = _cameraPositionBeforeEditMode;
 
                 _cameraPositionBeforeEditMode = Vector3.zero;
                 SceneView.lastActiveSceneView.Repaint();
 
                 _debriefEditorMode = false;
             }
         }
     }
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

21 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

Related Questions

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

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

Editor Camera Orthograpric Control 5 Answers

Scene view camera reverts to defaults when another window is minimized 1 Answer

turn off selection in the Scene View 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