Initial commit
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// An attribute that overrides the name of the type displayed in the SubclassSelector popup.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface,AllowMultiple = false,Inherited = false)]
|
||||
public sealed class AddTypeMenuAttribute : Attribute {
|
||||
|
||||
public string MenuName { get; }
|
||||
|
||||
public int Order { get; }
|
||||
|
||||
public AddTypeMenuAttribute (string menuName,int order = 0) {
|
||||
MenuName = menuName;
|
||||
Order = order;
|
||||
}
|
||||
|
||||
static readonly char[] k_Separeters = new char[] { '/' };
|
||||
|
||||
/// <summary>
|
||||
/// Returns the menu name split by the '/' separator.
|
||||
/// </summary>
|
||||
public string[] GetSplittedMenuName () {
|
||||
return !string.IsNullOrWhiteSpace(MenuName) ? MenuName.Split(k_Separeters,StringSplitOptions.RemoveEmptyEntries) : Array.Empty<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the display name without the path.
|
||||
/// </summary>
|
||||
public string GetTypeNameWithoutPath () {
|
||||
string[] splittedDisplayName = GetSplittedMenuName();
|
||||
return (splittedDisplayName.Length != 0) ? splittedDisplayName[splittedDisplayName.Length - 1] : null;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 679eba7e17def6847b382e7656079b5f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "MackySoft.SerializeReferenceExtensions",
|
||||
"rootNamespace": "",
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [
|
||||
"UNITY_2019_3_OR_NEWER"
|
||||
],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49b49c76ee64f6b41bf28ef951cb0e50
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Attribute to specify the type of the field serialized by the SerializeReference attribute in the inspector.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Field,AllowMultiple = false)]
|
||||
public sealed class SubclassSelectorAttribute : PropertyAttribute {
|
||||
|
||||
}
|
||||
#endif
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3addd6c6c68d9d74185d9dce466fa9af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user