I want to switch this panel on/off by C# script while playing. Is this possible? Haven't found any Editor API functions for this.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
You can do it with reflection. Modified similar answer I made long ago. Below is a working set/get stats function. Tested with Unity 5.4.0f1. I put the Unity version so that people won't complain when it stops working. Unity's update can break this anytime if they rename any of the variables.
GameView
= A class that is used to represent Unity GameView tab in the Editor.GetMainGameView
= static function that returns currentGameView
instance.m_Stats
= a boolean variable that is used to determine if stats should be displayed or not.Code:
Usage:
No it's not possible, unless you are a persistent hacker. GameView is an internal class, not accessible for editor scripting. But hey, there always is an option for good ol' reflection. This question will set you on the right track: http://answers.unity3d.com/questions/179775/game-window-size-from-editor-window-in-editor-mode.html