Thomas ICHÉ
5 年前
当前提交
8cb570dd
共有 8 个文件被更改,包括 135 次插入 和 7 次删除
-
1CHANGELOG.md
-
38Editor/HierarchyHints/HierarchyHints.cs
-
8Editor/CustomInspectors.meta
-
27Runtime/Ingredients/Folder.cs
-
11Runtime/Ingredients/Folder.cs.meta
-
46Editor/CustomInspectors/FolderEditor.cs
-
11Editor/CustomInspectors/FolderEditor.cs.meta
|
|||
fileFormatVersion: 2 |
|||
guid: b3467fc18385f3f41a4050759dc020e7 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
|
|||
namespace GameplayIngredients |
|||
{ |
|||
[ExecuteAlways] |
|||
public class Folder : MonoBehaviour |
|||
{ |
|||
public Color Color = Color.yellow; |
|||
|
|||
private void Awake() |
|||
{ |
|||
Reset(); |
|||
} |
|||
private void Reset() |
|||
{ |
|||
gameObject.isStatic = true; |
|||
transform.localPosition = Vector3.zero; |
|||
transform.localRotation = Quaternion.identity; |
|||
transform.localScale = Vector3.one; |
|||
if(Application.isPlaying) |
|||
{ |
|||
Destroy(this); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 40ebf4fc729b9924e85bf13fdbf9a6c3 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {fileID: -1463847995985908582, guid: 0000000000000000d000000000000000, type: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
|
|||
namespace GameplayIngredients.Editor |
|||
{ |
|||
[CustomEditor(typeof(Folder))] |
|||
public class FolderEditor : UnityEditor.Editor |
|||
{ |
|||
[MenuItem("GameObject/Folder", false, 10)] |
|||
static void CreateFolder() |
|||
{ |
|||
var go = new GameObject("Folder", typeof(Folder)); |
|||
if(Selection.activeGameObject != null && Selection.activeGameObject.scene != null) |
|||
{ |
|||
go.transform.parent = Selection.activeGameObject.transform; |
|||
} |
|||
} |
|||
|
|||
SerializedProperty m_Color; |
|||
|
|||
private void OnEnable() |
|||
{ |
|||
m_Color = serializedObject.FindProperty("Color"); |
|||
} |
|||
|
|||
public override bool HasPreviewGUI() |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
EditorGUI.BeginChangeCheck(); |
|||
var color = EditorGUILayout.ColorField("Folder Color", m_Color.colorValue); |
|||
if(EditorGUI.EndChangeCheck()) |
|||
{ |
|||
m_Color.colorValue = color; |
|||
serializedObject.ApplyModifiedProperties(); |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 474b95a56281dc44483708a7186ba29d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue