Table of Contents

Namespace Gamelogic.Extensions

This namespace contains classes that are meant to extend Unity in basic ways to make it easier to program games.

Classes

Clock

Represents a clock that expires after a given time.

ColorExtensions

Provides some utility functions for Colors.

ColorList

An InspectorList of type Color.

CommentAttribute

Used to mark a field to add a comment above the field in the inspector.

DiskCache<TKey, TValue>

A cache maintained on disk.

DummyAttribute

Used to mark the last field in a MonoBehaviour as a dummy so that it is not drawn. This is useful to add a decorator that should be displayed below all fields.

FixedSizeMemoryCache<TKey, TValue>

A cache maintained in memory that stays fixed in size.

FloatList

An InspectorList of type float.

GLDebug

Class that contains methods useful for debugging. All methods are only compiled if the DEBUG symbol is defined.

GLMathf

Methods for additional math functions.

GLMonoBehaviour

Provides some additional functions for MonoBehaviour.

GLPlayerPrefs

An alternative to PlayerPrefs that provides methods for setting bool and array preferences.

GLRandom

Some convenience functions for random bools and integers.

GameObjectExtensions

Provides useful extension methods for GameObjects.

Geometry

Provides utility methods for doing geometry.

HighlightAttribute

Mark simple types to be highligted in the inspector.

InspectorButtonAttribute

Gamelogic.Extensions.Editor.Internal.GLEditor`1.DrawInspectorButtons draws a button for each method marked with this attribute. This is also used by GLMonoBehaviourEditor.

InspectorFlagsAttribute

Mark fields that should be displayed as bit field mask in the inspector

InspectorList

The base class for the generic InspectorList. This class exists so that a single property drawer can be used for all subclasses.

InspectorList<T>

Exactly the same as generic List, but has a custom property drawer that draws a re-orderable list in the inspector.

IntList

An InspectorList of type int.

LabelFieldAttribute

Specifies a field to use as label for an item in the inspector. This is especially useful for arrays of compound types.

LayeredCache<TKey, TValue>

Represents a cache made out of two layers: a fast primary cache and a slow secondary cache. Things requested that are in the slow cache gets moved to the fast cache, and the oldest item in the fast cache moves to the slow cache.

New things are always added to the primary cache. The oldest item is moved to the slow cache if the primary cache is full.

MinMaxFloat

Class for representing a bounded range.

MinMaxInt

Class for representing a bounded range.

MonoBehaviourExtensions

Provides useful extension methods for MonoBehaviours.

MonoBehaviourList

An InspectorList of type MonoBehaviour.

MonoBehaviourPool<T>

A pool suitable for MonoBehaviour objects that can be instantiated from a given prefab.

NonNegativeAttribute

Mark numeric values that should always be non-negative.

NotImplementedByException

A version of NotImplementedException that takes the throwing type as argument. This is useful in class hierarchies where methods are meant to be overridden by derived types but cannot be made abstract (for example, because of Unity limitations). The exception, when thrown, indicates which class should have implemented the method, but hasn't.

ObjectExtensions

Provides extensions for objects.

ObjectList

An InspectorList of type Object.

ObservedValue<T>

Wraps a variable in a class that triggers an event if the value changes. This is useful when values can be meaningfully compared using Equals, and when the variable changes infrequently in comparison to the number of times it is updated.

Optional

The base class of the generic Optional class.

OptionalFloat

Represents an optional float value.

OptionalGameObject

Represents an optional GameObject.

OptionalInt

Represents an optional int value.

OptionalMonoBehaviour

Represents an optional MonoBehaviour.

OptionalString

Represents an optional string value.

OptionalVector2

Represents an optional Vector2 value.

OptionalVector3

Represents an optional Vector3 value.

Optional<T>

Useful for displaying optional values in the inspector.

Pool<T>

A light-weight pool class. Can be used out of the box, or as base for more sophisticated pools.

PositiveAttribute

Mark fields that should always be positive with this attribute.

PushdownAutomaton<TLabel>

This class is a state machine that has the ability to remember previous states and transition back to them (FIFO).

ReadOnlyAttribute

Used to mark inspectable fields as read-only (that is, making them uneditable, even if they are visible).

ResourceNotFoundException

Thrown when trying to load a resource (using Load(string) and variants) but the resource is not found.

ScreenshotTaker

Provides a generic implementation of a singleton-like pattern for MonoBehaviour classes. This class automatically searches for an existing instance in the scene or logs an error if none or more than one are found.

Singleton

Provides support for Singleton<T>.

SingletonSpawner<T>
Singleton<T>

Provides a generic implementation of a singleton-like pattern for MonoBehaviour classes. This class automatically searches for an existing instance in the scene or logs an error if none or more than one are found.

StateMachine<TLabel>

A lightweight state machine.

StateTracker<TStateData>

Tracks a number of states. Events are raised when any state is started, and when all has stopped.

StringList

An InspectorList of type string.

TimedStateTracker<TStateData>

The same as StateTracker, but states can also time out.

TransformExtensions

Contains useful extensions for Select.

TypeArgumentException

Thrown when a method is called with illegal type parameters, or a class is constructed with illegal type parameters.

Vector2List

An InspectorList of type Vector2.

Vector3List

An InspectorList of type Vector3.

Vector4List

An InspectorList of type Vector4.

VectorExtensions

Contains useful extension methods for vectors.

WarningIfNullAttribute

Mark fields in a MonoBehaviour with this attribute to give a specific warning when the field is not set.

Interfaces

ICache<TKey, TValue>

A data structure that can be used as a cache.

IRandom

Represents a random generator.

IStateToken<TStateData>

When a new state is started in a tracker, a token is created that wraps custom data, and can be used to stop the state later.

Enums

Singleton.FindResult

The result of the search for an instance of the singleton.