摘要:
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... 阅读全文
摘要:
using UnityEngine;using System.Collections;[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]public class starTest : MonoBehaviour{ private Mesh mesh; void Start() { } void Update() { }}代码是这么写的但是编译完后发现没增加组件,为啥呢……把拖到GameObject上的脚本删了然后在拖上就有了。原来这个是只有第一次被拖上时候才会增加组件,相当于依赖关系... 阅读全文