コガネブログ

平日更新を目標にUnityやC#、Visual Studioなどのゲーム開発アレコレを書いていきます

【Unity】Scene ビューの FOV(画角)を変更できるエディタ拡張「UnitySceneViewFovControl」メモ

はじめに

上記の「UnitySceneViewFovControl」を Unity プロジェクトに追加することで
Scene ビューの FOV(画角)を変更できるようになります

メモ

  • Windows 10
  • Unity 2017.3.0f3 Personal

上記の環境では次のエラーが発生して使用できない?

NullReferenceException: Object reference not set to an instance of an object
UTJ.UnityEditorExtension.SceneViewFovControl.GUIClip..cctor () (at Assets/SceneViewFovControl/Editor/GUIClipExtension.cs:17)
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for UTJ.UnityEditorExtension.SceneViewFovControl.GUIClip
UTJ.UnityEditorExtension.SceneViewFovControl.SceneViewHiddenApiExtension.PopGUIClips (UnityEditor.SceneView sceneView) (at Assets/SceneViewFovControl/Editor/SceneViewExtension.cs:54)
UTJ.UnityEditorExtension.SceneViewFovControl.SceneViewHiddenApiExtension.DoToolbarRightSideGUI (UnityEditor.SceneView sceneView, UnityEngine.GUIContent content, UnityEngine.GUIStyle style, System.Action`1 action) (at Assets/SceneViewFovControl/Editor/SceneViewExtension.cs:101)
UTJ.UnityEditorExtension.SceneViewFovControl.Status.OnSceneGUI (UnityEditor.SceneView sceneView) (at Assets/SceneViewFovControl/Editor/Status.cs:128)
UTJ.UnityEditorExtension.SceneViewFovControl.SceneViewFovControl.OnSceneGUI (UnityEditor.SceneView sceneView) (at Assets/SceneViewFovControl/Editor/SceneViewFovControl.cs:53)
UnityEditor.SceneView.CallOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2518)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1833)
UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1663)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:255)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

関連記事