コード例 #1
0
        protected void SurfaceField(string label, ref string field, bool dirtyMesh = true)
        {
            if (_surface?.name != field)
            {
                _surface = null;
            }

            var mb = target as MonoBehaviour;

            if (_surface == null && _table != null)
            {
                string currentFieldName = field;
                if (currentFieldName != null && _table.Table.Has <Surface>(currentFieldName))
                {
                    _surface = _table.gameObject.GetComponentsInChildren <SurfaceAuthoring>(true)
                               .FirstOrDefault(s => s.name == currentFieldName);
                }
            }

            EditorGUI.BeginChangeCheck();
            _surface = (SurfaceAuthoring)EditorGUILayout.ObjectField(label, _surface, typeof(SurfaceAuthoring), true);
            if (EditorGUI.EndChangeCheck())
            {
                FinishEdit(label, dirtyMesh);
                field = _surface != null ? _surface.name : "";
            }
        }
コード例 #2
0
 protected override void OnEnable()
 {
     base.OnEnable();
     _targetSurf = target as SurfaceAuthoring;
 }