unity-atoms/docs/api/unityatoms.editor.md
Adam Ramberg 3613e32c34 v3.0.0 🐉
2020-02-24 00:59:35 +01:00

22 KiB

id title hide_title sidebar_label
unityatoms.editor UnityAtoms.Editor true UnityAtoms.Editor

Namespace - UnityAtoms.Editor

EditorIconPostProcessor

Postprocessor that processes all scripts using the EditorIcon attribute and assigns the matching icon guid (matching the icon query name) to the script's meta. It's a very simple solution (and very hacky), but works really great.

Methods

OnPostprocessAllAssets(System.String[],System.String[],System.String[],System.String[])

Called when new assets are imported, deleted or moved.

Parameters
  • importedAssets - Imported assets.
  • deletedAssets - Deleted assets.
  • movedAssets - Moved assets.
  • movedFromAssetPaths - Moved from asset paths.

RegenereateAllAtoms

Internal utility class to regenerate all Atoms. Reachable via top menu bar and Tools/Unity Atoms/Regenerate All Atoms.

Methods

Regenereate

Create the editor window.


Templating

Internal class used for templating when generating new Atoms using the Generator.

Methods

ResolveConditionals(System.String,System.Collections.Generic.List{System.String})

Resolve conditionals from the provided tempalte.

Parameters
  • template - Template to resolve the conditionals from.
  • trueConditions - A list of conditionals that are true.
Returns

A new template string resolved and based on the provided template.


ResolveVariables(System.Collections.Generic.Dictionary{System.String,System.String},System.String)

Resolve variables in the provided string.

Parameters
  • templateVariables - Dictionay mapping template variables and their resolutions.
  • toResolve - The string to resolve.
Returns

A new template string resolved and based on the provided toResolve string.


GeneratorEditor

Editor class for the Generator. Use it via the top window bar at Tools / Unity Atoms / Generator. Only availble in UNITY_2019_1_OR_NEWER.

Methods

Init

Create the editor window.


AddAtomTypeToGenerate(UnityAtoms.Editor.AtomType)

Add provided AtomType to the list of Atom types to be generated.

Parameters
  • atomType - The AtomType to be added.

RemoveAtomTypeToGenerate(UnityAtoms.Editor.AtomType)

Remove provided AtomType from the list of Atom types to be generated.

Parameters
  • atomType - The AtomType to be removed.

SetWarningText(UnityAtoms.Editor.AtomType,System.Collections.Generic.List{UnityAtoms.Editor.AtomType})

Set and display warning text in the editor.

Parameters
  • atomType - AtomType to generate the warning for.
  • dependencies - The AtomTypes that this AtomType is depending on.

OnEnable

Called when editor is enabled.


CreateDivider

Helper method to create a divider.

Returns

The divider (VisualElement) created.


CreateAtomTypeToGenerateToggleRow(UnityAtoms.Editor.AtomType)

Helper to create toogle row for a specific AtomType.

Parameters
  • atomType - The provided AtomType.
Returns

A new toggle row (VisualElement).


AtomType

Internal module class that holds that regarding an Atom type.


Generator

Generator that generates new Atom types based on the input data. Used by the GeneratorEditor. Only availble in UNITY_2019_1_OR_NEWER.

Methods

Generate(System.String,System.String,System.Boolean,System.Collections.Generic.List{UnityAtoms.Editor.AtomType},System.String,System.String)

Generate new Atoms based on the input data.

Parameters
  • type - The type of Atom to generate.abstract Eg. double, byte, MyStruct, MyClass.
  • baseWritePath - Base write path (relative to the Asset folder) where the Atoms are going to be written to.
  • isEquatable - Is the type provided implementing IEquatable?
  • atomTypesToGenerate - A list of AtomTypes to be generated.
  • typeNamespace - If the type provided is defined under a namespace, provide that namespace here.
  • subUnityAtomsNamespace - By default the Atoms that gets generated will be under the namespace UnityAtoms. If you for example like it to be under UnityAtoms.MyNamespace you would then enter MyNamespace in this field.
Examples
namespace MyNamespace
{
    public struct MyStruct
    {
        public string Text;
        public int Number;
    }
}
var generator = new Generator();
generator.Generate("MyStruct", "", false, new List<AtomType>() { AtomTypes.ACTION }, "MyNamespace", ""); // Generates an Atom Action of type MyStruct

RemoveDuplicateNamespaces(System.String)

Removes duplicate namespaces, given content from a template.

Parameters
  • content - The content template to remove namespace from.
Returns

A copy of content, but without duplicate namespaces.


ResolveFileName(System.Collections.Generic.Dictionary{System.String,System.String},System.String,System.Int32,System.String,System.String,System.Int32)

Resolve file name based on input data.

Parameters
  • templateVariables - Template variables.
  • templateName - Template name.
  • lastIndexOfDoubleUnderscore - Last index of double underscore.
  • capitalizedType - Capitalized type.
  • capitalizedAtomType - Capitalized Atom type (string).
  • typeOccurrences - Number of occurrences of the type.
Returns

The filename to use.


ResolveDirPath(System.String,System.String,System.String,System.String)

Resolves the directory path based on the input data.

Parameters
  • baseWritePath - The base write path (relative to the Assets folder).
  • capitalizedAtomType - Capitalized Atom type (string).
  • templateName - Template name.
  • atomType - Atom type.
Returns

The directory to use.


Capitalize(System.String)

Capitalize the provided string.

Parameters
  • s - The string to capitalize.
Returns

A capitalized version of the string provided.


ShouldSkipTemplate(System.Collections.Generic.List{UnityAtoms.Editor.AtomType},System.String,System.Int32)

Given the input data, should generation of this template be skipped.

Parameters
  • atomTypesToGenerate - List of Atom types to generate.
  • capitalizedAtomType - Capitalized Atom type (string).
  • typeOccurrences - Number of occurrences of the type.
Returns

If we should skip the template or not.


AtomTypes

Internal static class holding predefined static AtomTypes.


AtomEventReferenceDrawer

A custom property drawer for Event References. Makes it possible to choose between an Event, Variable or a Variable Instancer.


AtomDrawer<T>

Type Parameters

  • T - The type of Atom the property drawer should apply to.

The base Unity Atoms property drawer. Makes it possible to create and add a new Atom via Unity's inspector. Only availble in UNITY_2018_4_OR_NEWER.


AtomReferenceDrawer

A custom property drawer for References. Makes it possible to choose between a value, Variable, Constant or a Variable Instancer.


StringVariableEditor

Variable Inspector of type string. Inherits from AtomVariableEditor


IntVariableEditor

Variable Inspector of type int. Inherits from AtomVariableEditor


GameObjectVariableEditor

Variable Inspector of type GameObject. Inherits from AtomVariableEditor


ColliderVariableEditor

Variable Inspector of type Collider. Inherits from AtomVariableEditor


BoolVariableEditor

Variable Inspector of type bool. Inherits from AtomVariableEditor


Vector2VariableEditor

Variable Inspector of type Vector2. Inherits from AtomVariableEditor


Collider2DVariableEditor

Variable Inspector of type Collider2D. Inherits from AtomVariableEditor


Vector3VariableEditor

Variable Inspector of type Vector3. Inherits from AtomVariableEditor


AtomVariableEditor

Custom editor for Variables. Provides a better user workflow and indicates when which variables can be edited


FloatVariableEditor

Variable Inspector of type float. Inherits from AtomVariableEditor


ColorVariableEditor

Variable Inspector of type Color. Inherits from AtomVariableEditor


BoolEventEditor

Event property drawer of type bool. Inherits from AtomEventEditor<bool, BoolEvent>. Only availble in UNITY_2019_1_OR_NEWER.


BoolBoolEventEditor

Event property drawer of type <bool, bool>. Inherits from AtomEventEditor<bool, bool, BoolEvent>. Only availble in UNITY_2019_1_OR_NEWER.


ColliderEventEditor

Event property drawer of type Collider. Inherits from AtomEventEditor<Collider, ColliderEvent>. Only availble in UNITY_2019_1_OR_NEWER.


ColorEventEditor

Event property drawer of type Color. Inherits from AtomEventEditor<Color, ColorEvent>. Only availble in UNITY_2019_1_OR_NEWER.


Vector2EventEditor

Event property drawer of type Vector2. Inherits from AtomEventEditor<Vector2, Vector2Event>. Only availble in UNITY_2019_1_OR_NEWER.


AtomEventEditor<T,E>

Type Parameters

  • T - The type of this event..
  • E - Event of type T.

Custom editor for Events. Adds the possiblity to raise an Event from Unity's Inspector.


AtomEventEditor<T1,T2,E>

Type Parameters

  • T1 - The first type of this Event.
  • T2 - The second type of this Event.
  • E - Event of type T1 and T2.

Custom editor for Events. Adds the possiblity to raise an Event from Unity's Inspector.


IntEventEditor

Event property drawer of type int. Inherits from AtomEventEditor<int, IntEvent>. Only availble in UNITY_2019_1_OR_NEWER.


Vector3Vector3EventEditor

Event property drawer of type <Vector3, Vector3>. Inherits from AtomEventEditor<Vector3, Vector3, Vector3Event>. Only availble in UNITY_2019_1_OR_NEWER.


GameObjectGameObjectEventEditor

Event property drawer of type <GameObject, GameObject>. Inherits from AtomEventEditor<GameObject, GameObject, GameObjectEvent>. Only availble in UNITY_2019_1_OR_NEWER.


FloatFloatEventEditor

Event property drawer of type <float, float>. Inherits from AtomEventEditor<float, float, FloatEvent>. Only availble in UNITY_2019_1_OR_NEWER.


Collider2DEventEditor

Event property drawer of type Collider2D. Inherits from AtomEventEditor<Collider2D, Collider2DEvent>. Only availble in UNITY_2019_1_OR_NEWER.


VoidEventEditor

Event property drawer of type Void. Only availble in UNITY_2019_1_OR_NEWER.


AtomBaseVariableEventEditor

Event property drawer of type AtomBaseVariable. Inherits from AtomEventEditor<AtomBaseVariable, AtomBaseVariableEvent>. Only availble in UNITY_2019_1_OR_NEWER.


Collider2DCollider2DEventEditor

Event property drawer of type <Collider2D, Collider2D>. Inherits from AtomEventEditor<Collider2D, Collider2D, Collider2DEvent>. Only availble in UNITY_2019_1_OR_NEWER.


ColliderColliderEventEditor

Event property drawer of type <Collider, Collider>. Inherits from AtomEventEditor<Collider, Collider, ColliderEvent>. Only availble in UNITY_2019_1_OR_NEWER.


FloatEventEditor

Event property drawer of type float. Inherits from AtomEventEditor<float, FloatEvent>. Only availble in UNITY_2019_1_OR_NEWER.


StringEventEditor

Event property drawer of type string. Inherits from AtomEventEditor<string, StringEvent>. Only availble in UNITY_2019_1_OR_NEWER.


GameObjectEventEditor

Event property drawer of type GameObject. Inherits from AtomEventEditor<GameObject, GameObjectEvent>. Only availble in UNITY_2019_1_OR_NEWER.


Vector3EventEditor

Event property drawer of type Vector3. Inherits from AtomEventEditor<Vector3, Vector3Event>. Only availble in UNITY_2019_1_OR_NEWER.


IntIntEventEditor

Event property drawer of type <int, int>. Inherits from AtomEventEditor<int, int, IntEvent>. Only availble in UNITY_2019_1_OR_NEWER.


ColorColorEventEditor

Event property drawer of type <Color, Color>. Inherits from AtomEventEditor<Color, Color, ColorEvent>. Only availble in UNITY_2019_1_OR_NEWER.


Vector2Vector2EventEditor

Event property drawer of type <Vector2, Vector2>. Inherits from AtomEventEditor<Vector2, Vector2, Vector2Event>. Only availble in UNITY_2019_1_OR_NEWER.


StringStringEventEditor

Event property drawer of type <string, string>. Inherits from AtomEventEditor<string, string, StringEvent>. Only availble in UNITY_2019_1_OR_NEWER.


Collider2DConstantDrawer

Constant property drawer of type Collider2D. Inherits from AtomDrawer<Collider2DConstant>. Only availble in UNITY_2019_1_OR_NEWER.


Vector2ConstantDrawer

Constant property drawer of type Vector2. Inherits from AtomDrawer<Vector2Constant>. Only availble in UNITY_2019_1_OR_NEWER.


FloatConstantDrawer

Constant property drawer of type float. Inherits from AtomDrawer<FloatConstant>. Only availble in UNITY_2019_1_OR_NEWER.


Vector3ConstantDrawer

Constant property drawer of type Vector3. Inherits from AtomDrawer<Vector3Constant>. Only availble in UNITY_2019_1_OR_NEWER.


ColorConstantDrawer

Constant property drawer of type Color. Inherits from AtomDrawer<ColorConstant>. Only availble in UNITY_2019_1_OR_NEWER.


StringConstantDrawer

Constant property drawer of type string. Inherits from AtomDrawer<StringConstant>. Only availble in UNITY_2019_1_OR_NEWER.


IntConstantDrawer

Constant property drawer of type int. Inherits from AtomDrawer<IntConstant>. Only availble in UNITY_2019_1_OR_NEWER.


GameObjectConstantDrawer

Constant property drawer of type GameObject. Inherits from AtomDrawer<GameObjectConstant>. Only availble in UNITY_2019_1_OR_NEWER.


ColliderConstantDrawer

Constant property drawer of type Collider. Inherits from AtomDrawer<ColliderConstant>. Only availble in UNITY_2019_1_OR_NEWER.


BoolConstantDrawer

Constant property drawer of type bool. Inherits from AtomDrawer<BoolConstant>. Only availble in UNITY_2019_1_OR_NEWER.


StringReferenceAtomBaseVariableDictionaryDrawer

SerializableDictionary property drawer for type <StringReference, AtomBaseVariable>. Inherits from SerializableDictionaryDrawer<StringReference, AtomBaseVariable, StringReferenceAtomBaseVariableDictionary>. Only availble in UNITY_2019_1_OR_NEWER.


SerializableDictionaryDrawer3`

A custom property drawer for SerializableDictionary.


ColorVariableDrawer

Variable property drawer of type Color. Inherits from AtomDrawer<ColorVariable>. Only availble in UNITY_2019_1_OR_NEWER.


Vector3VariableDrawer

Variable property drawer of type Vector3. Inherits from AtomDrawer<Vector3Variable>. Only availble in UNITY_2019_1_OR_NEWER.


FloatVariableDrawer

Variable property drawer of type float. Inherits from AtomDrawer<FloatVariable>. Only availble in UNITY_2019_1_OR_NEWER.


Vector2VariableDrawer

Variable property drawer of type Vector2. Inherits from AtomDrawer<Vector2Variable>. Only availble in UNITY_2019_1_OR_NEWER.


Collider2DVariableDrawer

Variable property drawer of type Collider2D. Inherits from AtomDrawer<Collider2DVariable>. Only availble in UNITY_2019_1_OR_NEWER.


GameObjectVariableDrawer

Variable property drawer of type GameObject. Inherits from AtomDrawer<GameObjectVariable>. Only availble in UNITY_2019_1_OR_NEWER.


BoolVariableDrawer

Variable property drawer of type bool. Inherits from AtomDrawer<BoolVariable>. Only availble in UNITY_2019_1_OR_NEWER.


ColliderVariableDrawer

Variable property drawer of type Collider. Inherits from AtomDrawer<ColliderVariable>. Only availble in UNITY_2019_1_OR_NEWER.


IntVariableDrawer

Variable property drawer of type int. Inherits from AtomDrawer<IntVariable>. Only availble in UNITY_2019_1_OR_NEWER.


StringVariableDrawer

Variable property drawer of type string. Inherits from AtomDrawer<StringVariable>. Only availble in UNITY_2019_1_OR_NEWER.


AtomBaseVariableListDrawer

A custom property drawer for AtomBaseVariableList.


IntIntEventDrawer

Event x 2 property drawer of type int. Inherits from AtomDrawer<IntIntEvent>. Only availble in UNITY_2019_1_OR_NEWER.


ColorColorEventDrawer

Event x 2 property drawer of type Color. Inherits from AtomDrawer<ColorColorEvent>. Only availble in UNITY_2019_1_OR_NEWER.


StringStringEventDrawer

Event x 2 property drawer of type string. Inherits from AtomDrawer<StringStringEvent>. Only availble in UNITY_2019_1_OR_NEWER.


Vector2Vector2EventDrawer

Event x 2 property drawer of type Vector2. Inherits from AtomDrawer<Vector2Vector2Event>. Only availble in UNITY_2019_1_OR_NEWER.


Vector3EventDrawer

Event property drawer of type Vector3. Inherits from AtomDrawer<Vector3Event>. Only availble in UNITY_2019_1_OR_NEWER.


FloatEventDrawer

Event property drawer of type float. Inherits from AtomDrawer<FloatEvent>. Only availble in UNITY_2019_1_OR_NEWER.


ColliderColliderEventDrawer

Event x 2 property drawer of type Collider. Inherits from AtomDrawer<ColliderColliderEvent>. Only availble in UNITY_2019_1_OR_NEWER.


GameObjectEventDrawer

Event property drawer of type GameObject. Inherits from AtomDrawer<GameObjectEvent>. Only availble in UNITY_2019_1_OR_NEWER.


StringEventDrawer

Event property drawer of type string. Inherits from AtomDrawer<StringEvent>. Only availble in UNITY_2019_1_OR_NEWER.


AtomBaseVariableEventDrawer

Event property drawer of type AtomBaseVariable. Inherits from AtomDrawer<AtomBaseVariableEvent>. Only availble in UNITY_2019_1_OR_NEWER.


Collider2DCollider2DEventDrawer

Event x 2 property drawer of type Collider2D. Inherits from AtomDrawer<Collider2DCollider2DEvent>. Only availble in UNITY_2019_1_OR_NEWER.


VoidEventDrawer

Event property drawer of type Void. Inherits from AtomDrawer<VoidEvent>. Only availble in UNITY_2019_1_OR_NEWER.


Collider2DEventDrawer

Event property drawer of type Collider2D. Inherits from AtomDrawer<Collider2DEvent>. Only availble in UNITY_2019_1_OR_NEWER.


FloatFloatEventDrawer

Event x 2 property drawer of type float. Inherits from AtomDrawer<FloatFloatEvent>. Only availble in UNITY_2019_1_OR_NEWER.


Vector3Vector3EventDrawer

Event x 2 property drawer of type Vector3. Inherits from AtomDrawer<Vector3Vector3Event>. Only availble in UNITY_2019_1_OR_NEWER.


IntEventDrawer

Event property drawer of type int. Inherits from AtomDrawer<IntEvent>. Only availble in UNITY_2019_1_OR_NEWER.


GameObjectGameObjectEventDrawer

Event x 2 property drawer of type GameObject. Inherits from AtomDrawer<GameObjectGameObjectEvent>. Only availble in UNITY_2019_1_OR_NEWER.


BoolBoolEventDrawer

Event x 2 property drawer of type bool. Inherits from AtomDrawer<BoolBoolEvent>. Only availble in UNITY_2019_1_OR_NEWER.


ColliderEventDrawer

Event property drawer of type Collider. Inherits from AtomDrawer<ColliderEvent>. Only availble in UNITY_2019_1_OR_NEWER.


Vector2EventDrawer

Event property drawer of type Vector2. Inherits from AtomDrawer<Vector2Event>. Only availble in UNITY_2019_1_OR_NEWER.


ColorEventDrawer

Event property drawer of type Color. Inherits from AtomDrawer<ColorEvent>. Only availble in UNITY_2019_1_OR_NEWER.


BoolEventDrawer

Event property drawer of type bool. Inherits from AtomDrawer<BoolEvent>. Only availble in UNITY_2019_1_OR_NEWER.


FloatValueListDrawer

Value List property drawer of type float. Inherits from AtomDrawer<FloatValueList>. Only availble in UNITY_2019_1_OR_NEWER.


BoolValueListDrawer

Value List property drawer of type bool. Inherits from AtomDrawer<BoolValueList>. Only availble in UNITY_2019_1_OR_NEWER.


IntValueListDrawer

Value List property drawer of type int. Inherits from AtomDrawer<IntValueList>. Only availble in UNITY_2019_1_OR_NEWER.


ColorValueListDrawer

Value List property drawer of type Color. Inherits from AtomDrawer<ColorValueList>. Only availble in UNITY_2019_1_OR_NEWER.


StringValueListDrawer

Value List property drawer of type string. Inherits from AtomDrawer<StringValueList>. Only availble in UNITY_2019_1_OR_NEWER.


Vector3ValueListDrawer

Value List property drawer of type Vector3. Inherits from AtomDrawer<Vector3ValueList>. Only availble in UNITY_2019_1_OR_NEWER.


GameObjectValueListDrawer

Value List property drawer of type GameObject. Inherits from AtomDrawer<GameObjectValueList>. Only availble in UNITY_2019_1_OR_NEWER.


ColliderValueListDrawer

Value List property drawer of type Collider. Inherits from AtomDrawer<ColliderValueList>. Only availble in UNITY_2019_1_OR_NEWER.


Vector2ValueListDrawer

Value List property drawer of type Vector2. Inherits from AtomDrawer<Vector2ValueList>. Only availble in UNITY_2019_1_OR_NEWER.


Collider2DValueListDrawer

Value List property drawer of type Collider2D. Inherits from AtomDrawer<Collider2DValueList>. Only availble in UNITY_2019_1_OR_NEWER.


ClampBaseEditor

Base class for a custom editor for Clamp Functions.


ClampFloatEditor

Custom editor for ClampFloat.


ClampIntEditor

Custom editor for ClampInt.