CustomEditor的文件要放在Assets/Editor目录下
摘要:using UnityEditor;using UnityEngine;[CustomEditor(typeof(test))]public class testEditor : Editor{ void OnEnable() { } public override void OnInspectorGUI() { test myTarget = (test)target; myTarget.MyValue = EditorGUILayout.IntSlider( "Val-you", myTarget.My...
阅读全文
posted @
2013-10-16 11:43
xbg
阅读(1011)
推荐(0)
Unity中使用RequireComponent,没有添加上组件
摘要:using UnityEngine;using System.Collections;[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]public class starTest : MonoBehaviour{ private Mesh mesh; void Start() { } void Update() { }}代码是这么写的但是编译完后发现没增加组件,为啥呢……把拖到GameObject上的脚本删了然后在拖上就有了。原来这个是只有第一次被拖上时候才会增加组件,相当于依赖关系...
阅读全文
posted @
2013-10-16 11:06
xbg
阅读(986)
推荐(0)