2个回答
2016-06-19
展开全部
Inspector中的变量的视图形式一般是固定的,int、float 就是文本框。
要实现你这个功能,要写 UnityEditor 插件(引入 UnityEditor 的 namespace),滑动条是
EditorGUILayout.Slider
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Editor script that lets you scale the selected GameObject between 1 and 100
//缩放选择的游戏物体,在1-100之间
class EditorGUILayoutSlider extends EditorWindow {
var scale : float = 0.0;
@MenuItem("Examples/Editor GUILayout Slider usage")
static function Init() {
var window = GetWindow(EditorGUILayoutSlider);
window.Show();
}
function OnGUI() {
scale = EditorGUILayout.Slider(scale,1, 100);
}
function OnInspectorUpdate() {
if(Selection.activeTransform)
Selection.activeTransform.localScale = Vector3(scale, scale, scale);
}
}
要实现你这个功能,要写 UnityEditor 插件(引入 UnityEditor 的 namespace),滑动条是
EditorGUILayout.Slider
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Editor script that lets you scale the selected GameObject between 1 and 100
//缩放选择的游戏物体,在1-100之间
class EditorGUILayoutSlider extends EditorWindow {
var scale : float = 0.0;
@MenuItem("Examples/Editor GUILayout Slider usage")
static function Init() {
var window = GetWindow(EditorGUILayoutSlider);
window.Show();
}
function OnGUI() {
scale = EditorGUILayout.Slider(scale,1, 100);
}
function OnInspectorUpdate() {
if(Selection.activeTransform)
Selection.activeTransform.localScale = Vector3(scale, scale, scale);
}
}
追问
答案我告诉你吧obj.SetActive(true);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询