Initial Commit
This commit is contained in:
commit
ee5c2f922d
2255 changed files with 547750 additions and 0 deletions
25
Assets/Plugins/Light2D/Examples/Editor/ReadOnlyDrawer.cs
Normal file
25
Assets/Plugins/Light2D/Examples/Editor/ReadOnlyDrawer.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Light2D.Examples
|
||||
{
|
||||
[CustomPropertyDrawer(typeof (ReadOnlyAttribute))]
|
||||
public class ReadOnlyDrawer : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight(SerializedProperty property,
|
||||
GUIContent label)
|
||||
{
|
||||
return EditorGUI.GetPropertyHeight(property, label, true);
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position,
|
||||
SerializedProperty property,
|
||||
GUIContent label)
|
||||
{
|
||||
GUI.enabled = false;
|
||||
EditorGUI.PropertyField(position, property, label, true);
|
||||
GUI.enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fdaeb1b76be3e574880a040f02541392
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
internal class ScriptableObjectCreatorWindow : EditorWindow
|
||||
{
|
||||
private string _className = "";
|
||||
|
||||
// Add menu named "My Window" to the Window menu
|
||||
[MenuItem("Window/Scriptable Object Creator")]
|
||||
private static void Init()
|
||||
{
|
||||
// Get existing open window or if none, make a new one:
|
||||
var window = (ScriptableObjectCreatorWindow) EditorWindow.GetWindow(typeof (ScriptableObjectCreatorWindow));
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
_className = EditorGUILayout.TextField("Class Name", _className);
|
||||
|
||||
if (GUILayout.Button("Create"))
|
||||
{
|
||||
CreateAsset(_className);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
// This makes it easy to create, name and place unique new ScriptableObject asset files.
|
||||
/// </summary>
|
||||
public static void CreateAsset(string type)
|
||||
{
|
||||
var asset = ScriptableObject.CreateInstance(type);
|
||||
|
||||
string path = AssetDatabase.GetAssetPath(Selection.activeObject);
|
||||
if (path == "")
|
||||
{
|
||||
path = "Assets";
|
||||
}
|
||||
else if (Path.GetExtension(path) != "")
|
||||
{
|
||||
path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), "");
|
||||
}
|
||||
|
||||
Debug.Log(path + "/" + type + ".asset");
|
||||
|
||||
string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/" + type + ".asset");
|
||||
|
||||
AssetDatabase.CreateAsset(asset, assetPathAndName);
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
EditorUtility.FocusProjectWindow();
|
||||
Selection.activeObject = asset;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ca142a7c9b188174b8abfa435ac4b3af
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
Loading…
Add table
Add a link
Reference in a new issue