Reupload to new git vps.
This commit is contained in:
commit
1f1ac4ae74
10 changed files with 138 additions and 0 deletions
3
DCBlankParentObject.asmdef
Normal file
3
DCBlankParentObject.asmdef
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"name": "DCBlankParentObject"
|
||||||
|
}
|
7
DCBlankParentObject.asmdef.meta
Normal file
7
DCBlankParentObject.asmdef.meta
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 61d1c1edaeaf78c46ac8ceaf339d290b
|
||||||
|
AssemblyDefinitionImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Editor.meta
Normal file
8
Editor.meta
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 29a62a24ea6eda14994f0232157d71f2
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
63
Editor/BlankParentObjectEditor.cs
Normal file
63
Editor/BlankParentObjectEditor.cs
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditorInternal;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace DC.Tools
|
||||||
|
{
|
||||||
|
[CustomEditor(typeof(BlankParentObject))]
|
||||||
|
[CanEditMultipleObjects]
|
||||||
|
public class BlankParentObjectEditor : Editor
|
||||||
|
{
|
||||||
|
private BlankParentObject _blankParentObject;
|
||||||
|
private Tool _lastTool = Tool.None;
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
CheckAndSetObject();
|
||||||
|
|
||||||
|
if (_blankParentObject == null)
|
||||||
|
{
|
||||||
|
Debug.LogError("Cannot find BlankParentObject");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_blankParentObject.ZeroTransform();
|
||||||
|
|
||||||
|
if (_blankParentObject.GetComponents<MonoBehaviour>()[0] != _blankParentObject)
|
||||||
|
ComponentUtility.MoveComponentUp(_blankParentObject);
|
||||||
|
|
||||||
|
_lastTool = UnityEditor.Tools.current;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
UnityEditor.Tools.current = _lastTool;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
CheckAndSetObject();
|
||||||
|
|
||||||
|
var objectTransform = _blankParentObject.gameObject.GetComponent<Transform>();
|
||||||
|
if (objectTransform.hideFlags != HideFlags.HideInInspector)
|
||||||
|
objectTransform.hideFlags = HideFlags.HideInInspector;
|
||||||
|
|
||||||
|
if (UnityEditor.Tools.current != Tool.None)
|
||||||
|
{
|
||||||
|
UnityEditor.Tools.current = Tool.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.HelpBox("Remove this script to re-enable Transform component", MessageType.Info);
|
||||||
|
InternalEditorUtility.SetIsInspectorExpanded(target, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckAndSetObject()
|
||||||
|
{
|
||||||
|
if (_blankParentObject == null) _blankParentObject = target as BlankParentObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
2
Editor/BlankParentObjectEditor.cs.meta
Normal file
2
Editor/BlankParentObjectEditor.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 61feae19c726fec47b838df729ab2c98
|
8
Runtime.meta
Normal file
8
Runtime.meta
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 301a33335947903448222abbaf1a6f11
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
25
Runtime/BlankParentObject.cs
Normal file
25
Runtime/BlankParentObject.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace DC.Tools
|
||||||
|
{
|
||||||
|
[ExecuteInEditMode]
|
||||||
|
public class BlankParentObject : MonoBehaviour
|
||||||
|
{
|
||||||
|
private void Start() => ZeroTransform();
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
transform.hideFlags = HideFlags.None;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ZeroTransform()
|
||||||
|
{
|
||||||
|
var cachedTrans = transform;
|
||||||
|
cachedTrans.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
|
||||||
|
cachedTrans.localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f);
|
||||||
|
cachedTrans.localScale = new Vector3(1.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2
Runtime/BlankParentObject.cs.meta
Normal file
2
Runtime/BlankParentObject.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e218870a3af85ea4096508e3744df732
|
13
package.json
Normal file
13
package.json
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"name": "com.danielcumbor.blankparentobject",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"displayName": "DC Blank Parent Object",
|
||||||
|
"description": "Creates blank gameobjects that can act as folders.",
|
||||||
|
"unity": "6000.0",
|
||||||
|
"unityRelease": "23f1",
|
||||||
|
"author": {
|
||||||
|
"name": "Daniel Cumbor",
|
||||||
|
"email": "danc@ultr.uk",
|
||||||
|
"url": "https://code.ultr.uk"
|
||||||
|
}
|
||||||
|
}
|
7
package.json.meta
Normal file
7
package.json.meta
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6ab12329ce8b77a40992369c0b1f0e13
|
||||||
|
PackageManifestImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in a new issue