NonSerializedExamples.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;
using EyE.Unity;
{
public class NonSerializedExamples
{
static List<Type> listOfTypes = new List<Type>() { typeof(TextMesh), typeof(string), typeof(MonoBehaviour) };
static List<Vector3> listOfVectors = new List<Vector3>();
static UnityEngine.Object objectReference = null;
static bool numberLists = true;
//[PreferenceItem("<EyE> Examples")]
public static void DrawPrefs()
{
if (GUILayout.Button("reset"))
{
listOfTypes.Clear();
listOfVectors.Clear();
objectReference = null;
}
EditorGUILayout.LabelField("Example of displaying Lists that are NOT serialized, in an editor. (Recompiling, or reloading the scene or project will reset these values.)");
numberLists = EditorGUILayout.Toggle("Number Lists", numberLists);
listOfTypes = EditorUtil.SimpleListFieldLayout<Type>(new GUIContent("List of Components"), listOfTypes, PopupComponentTypes,default(Type), numberLists);
listOfVectors = EditorUtil.SimpleListFieldLayout<Vector3>(new GUIContent("List of Vector3s"), listOfVectors,null,Vector3.zero, numberLists);
objectReference = EditorGUILayout.ObjectField("Object Reference",objectReference, typeof(ScriptableObject),false);
bool renameNow = EditorGUILayout.Toggle("Rename Object", false);// renameObjectIcon, EditorStyles.label);
if (renameNow)
{
System.Action<string> renameCallback = new System.Action<string>(
(xstr) =>
{
objectReference.name = xstr;
SettingsService.NotifySettingsProviderChanged();
});
RenamePopupWindow.PopUp(objectReference.name, renameCallback, false, "Rename Object",default(Rect), objectReference);
}
}
static public object PopupComponentTypes(GUIContent label,object objectToDraw)
{
List<System.Type> ignored;
Type selecteType=EditorUtil.TypePopup(label, (System.Type)objectToDraw, typeof(Component), out ignored, true);
// Debug.Log("Selected Type :" + selecteType.Name);
return (object)selecteType;
}
}
}
EyE.EditorUnity.Examples
This namespace is not included in the DLL modules, it contains code samples intended for documentatio...
Definition: ExtractEyeEnginesLogo.cs:6
EyE
This namespace contains classes that provide various tools for use in the Unity Editor.
Definition: EmbededXMLTooltip.cs:5
EyE.Unity
This namespace holds classes that extended or inherit from various Unity defined classes....
Definition: EmbededXMLTooltip.cs:5
EyE.EditorUnity
This namespace is used to provide a User Interface, in Unity's Editor, for various library classes....
Definition: ExtractEyeEnginesLogo.cs:6
EyE.EditorUnity.Tools
Definition: AssetDatabaseHelper.cs:6