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 WallHackJack · Jul 18, 2017 at 09:02 AM · editorbeginnereditorgui

Working with very tiny objects / Reducing editor camera fly speed

Hi, when I started my game, I accidentally made everything very small. Everything has been fine, 3d audio was a pain for a second. There are a few things making my workflow harder because of this however:

1) The editor camera's fly speed is incredibly fast. Even after double clicking items to bring the camera down to scale, the camera speed still doesnt allow me to get the precise postitioning I need. Is there a way to change this or change the

2) Object's like particle systems and sounds have an annoying image representing them in 3d space. The problem is these representations are huge images and cover up my objects. Is there a way to turn these overlay items off, or better yet, reduce their size by like 100x?

Great thank you, Jack

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 AurimasBlazulionis · Jul 18, 2017 at 09:12 AM 2
Share

Why don't you create a gameobject at 0, 0, 0 coordinates, put everything to that object and scale the object to scale everything up?

avatar image WallHackJack AurimasBlazulionis · Jul 18, 2017 at 10:14 AM 0
Share

That's a nifty solution but way out of scope, lots of scales/rotations (not-local) already controlled by scripts. Honestly unity does a fine job handling the small scene, aside from the 2 items mentioned above. A volume-by-distance multiplier on the audio listener would be the only thing missing that increased development time.

1 Reply

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

Answer by Bunny83 · Jul 18, 2017 at 10:58 AM

Well first you can disable or adjust the size of the 3D Icons over the Gizmos menu of the SceneView:

SceneViewIconSize

However there's no "proper" solution to your speed problem as the speed is unfortunately hardcoded in the SceneView controls. Feel free to vote for a configurable flyspeed over here.

However I've just come up with a neat workaround by blocking the default WASD behaviour and implementing my own. Just copy this script into an editor folder inside your project:

 //SceneViewCamSpeed.cs
 using UnityEngine;
 using UnityEditor;
 
 namespace B83.UnityEditor
 {
     public class SceneViewCamSpeed : EditorWindow
     {
         [MenuItem("Tools/SceneViewCamSpeed")]
         private static void Init()
         {
             GetWindow<SceneViewCamSpeed>();
         }
         private static TimeHelper m_Time;
         public float m_Speed = 1f;
         public float m_SpeedMult = 1f;
         public float m_CurrentSpeed = 1f;
         public Vector3 m_Motion;
         public bool m_EnableCustomControl = true;
         public bool m_AutoIncrease = true;
         public bool m_ShowSceneViewGUI = false;
         public bool m_FPSActive = false;
 
         private void OnEnable()
         {
             m_SpeedMult = EditorPrefs.GetFloat("B83.svcs_speed", m_SpeedMult);
             m_EnableCustomControl = EditorPrefs.GetBool("B83.svcs_enabled", m_EnableCustomControl);
             m_AutoIncrease = EditorPrefs.GetBool("B83.svcs_autoInc", m_AutoIncrease);
             m_ShowSceneViewGUI = EditorPrefs.GetBool("B83.svcs_showSceneGUI", m_ShowSceneViewGUI);
 
             m_Speed = Mathf.Log(m_SpeedMult);
             minSize = new Vector2(220, 20);
             titleContent = new GUIContent("SV_CamSpeed");
             SceneView.onSceneGUIDelegate += OnSceneGUI;
         }
         private void OnDisable()
         {
             SceneView.onSceneGUIDelegate -= OnSceneGUI;
         }
         private void DrawSpeedGUI(bool aSceneView)
         {
             if (aSceneView)
                 GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene);
             else
                 GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector);
             GUILayout.BeginHorizontal();
             GUILayout.BeginHorizontal(/*"box"*/);
             GUILayout.Label("Speed:", GUILayout.Width(50));
             GUI.changed = false;
             m_SpeedMult = EditorGUILayout.FloatField(m_SpeedMult, GUILayout.Width(50));
             if (GUI.changed)
             {
                 m_Speed = Mathf.Log(m_SpeedMult);
                 EditorPrefs.SetFloat("B83.svcs_speed", m_SpeedMult);
             }
             GUI.changed = false;
             m_Speed = GUILayout.HorizontalSlider(m_Speed, -8, 8);
             if (GUI.changed)
             {
                 m_SpeedMult = Mathf.Exp(m_Speed);
                 EditorPrefs.SetFloat("B83.svcs_speed", m_SpeedMult);
             }
             GUILayout.EndHorizontal();
             if (aSceneView)
                 GUILayout.Space(100);
             GUILayout.EndHorizontal();
         }
         private void OnGUI()
         {
             DrawSpeedGUI(false);
             EditorGUI.BeginChangeCheck();
             m_EnableCustomControl = GUILayout.Toggle(m_EnableCustomControl, "enabled");
             m_AutoIncrease = GUILayout.Toggle(m_AutoIncrease, "auto increase");
             m_ShowSceneViewGUI = GUILayout.Toggle(m_ShowSceneViewGUI, "Show speed slider in SceneView");
             if (EditorGUI.EndChangeCheck())
             {
                 EditorPrefs.SetBool("B83.svcs_enabled", m_EnableCustomControl);
                 EditorPrefs.SetBool("B83.svcs_autoInc", m_AutoIncrease);
                 EditorPrefs.SetBool("B83.svcs_showSceneGUI", m_ShowSceneViewGUI);
                 SceneView.RepaintAll();
             }
         }
         private void OnSceneGUI(SceneView sceneView)
         {
             if (!m_EnableCustomControl)
                 return;
             if (m_ShowSceneViewGUI)
             {
                 Handles.BeginGUI();
                 DrawSpeedGUI(true);
                 Handles.EndGUI();
             }
             var e = Event.current;
             if (e.type == EventType.MouseDown && e.button == 1)
                 m_FPSActive = true;
             if (e.type == EventType.MouseUp)
                 m_FPSActive = false;
 
             if (e.type == EventType.KeyDown && m_FPSActive)
             {
                 switch (e.keyCode)
                 {
                     case KeyCode.W:
                         m_Motion.z = 1;
                         e.Use();
                         break;
                     case KeyCode.A:
                         m_Motion.x = -1;
                         e.Use();
                         break;
                     case KeyCode.S:
                         m_Motion.z = -1;
                         e.Use();
                         break;
                     case KeyCode.D:
                         m_Motion.x = 1;
                         e.Use();
                         break;
                     case KeyCode.E:
                         m_Motion.y = 1;
                         e.Use();
                         break;
                     case KeyCode.Q:
                         m_Motion.y = -1;
                         e.Use();
                         break;
                 }
             }
             else if (e.type == EventType.KeyUp)
             {
                 switch (e.keyCode)
                 {
                     case KeyCode.W:
                     case KeyCode.S:
                         m_Motion.z = 0;
                         break;
                     case KeyCode.A:
                     case KeyCode.D:
                         m_Motion.x = 0;
                         break;
                     case KeyCode.E:
                     case KeyCode.Q:
                         m_Motion.y = 0;
                         break;
                 }
             }
             else if (e.type == EventType.Layout)
             {
                 if (m_Motion == Vector3.zero)
                 {
                     m_Time.Begin();
                     m_CurrentSpeed = m_SpeedMult;
                 }
                 else if (m_FPSActive)
                 {
                     float dt = m_Time.Update();
                     var forward = Quaternion.LookRotation(Camera.current.transform.forward);
                     var offset = forward * m_Motion;
                     if(m_AutoIncrease)
                         m_CurrentSpeed *= Mathf.Pow(1.8f, dt);
                     if (e.shift)
                         dt *= 3;
                     sceneView.LookAtDirect(sceneView.pivot + offset * dt * m_CurrentSpeed, sceneView.rotation);
                     sceneView.Repaint();
                 }
             }
         }
     }
 
     internal struct TimeHelper
     {
         public float deltaTime;
         private long lastTime;
         public void Begin()
         {
             lastTime = System.DateTime.Now.Ticks;
         }
         public float Update()
         {
             deltaTime = (float)(System.DateTime.Now.Ticks - this.lastTime) / 1E+07f;
             lastTime = System.DateTime.Now.Ticks;
             return this.deltaTime;
         }
     }
 }

You can open this tool window from the main menu "Tools-->SceneViewCamSpeed". While the window is open and "enabled" it will override the default WASD controls in the SceneView. You can control the speed in a wide range. The settings will be stored in the editor config. The window can be docked anywhere. You can enable the slider control so it shows up at the top of the SceneView.


sceneviewiconsize.png (12.0 kB)
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 WallHackJack · Jul 18, 2017 at 12:24 PM 0
Share

Fantastic answer, thank you, I put 10 votes for that.

avatar image WallHackJack · Jul 18, 2017 at 12:27 PM 0
Share

Do you have a better solution for scaling 3d audio distance globally? Something like listener.volumeDistance$$anonymous$$uliplier = 0.01?

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

89 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 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 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 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Initialising List array for use in a custom Editor 1 Answer

Is there a way to stylize EditorGUI.ObjectField? 0 Answers

Prompting dialogue box for input in Editor? 1 Answer

Detect when the Build button was pressed 2 Answers

Making a clickable button in Editor Mode 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