Gamelogic Extensions


Version: 2.6.0


Extensions is a library for Unity Game Engine that contains light-weight utility classes and convenient extension methods for some Unity classes. All other Gamelogic libraries depend on Extensions.

Here are some of the most important classes.

Pattern Classes

Class Description
Singleton<T> Extend from this class to provide global static access to a mono behaviour.
StateMachine<TLabel> Use this class to manage different behaviours for different states.
Pool<T> Use this class to manage objects in a pool to avoid unnecessary creation / destruction of objects.
ObservedValue<T> Use this class to get notified when the value of a variable changes.
Clock Use this class as an alternative to schedule delayed actions and useful display of time using strings.
StateTracker<TStateData> This class helps keep track of states (such as loading) that can happen simultaneously and asynchronously.
Optional<T> Used for data in the inspector that is optional.

Algorithm Classes

These classes serve as building blocks for implementing certain algorithms

Class Description
Combinatorial Contains methods for creating combinatorial structures, such as tuples, partitions, and permutations.
Generator Contains methods for creating generators (instances of the IGenerator interface). Generators work like random number generators, but can generate other objects than numbers, and in other patterns than random. See @Gamelogic.Extensions.Generator.
IResponseCurve<T> Response curves are piece-wise linear functions of float that work similar to gradients or animation curves, but for other types.

Extension methods

These classes provide extension methods for some Unity classes.

Unity Supplement Classes

These classes provide are meant to be similar to some Unity standard classes, but provide extra functionality.

Tool Support Classes

Class Description
InspectorList<T> A list that can be edited in the inspector. For items to be visible in the inspector, a subclass that is not generic should be used. Several subclasses are for common types, for example IntList
InspectorButtonAttribute For each methods in GLMonoBehaviours marked with this attribute, a button appears on the component in the inspector that will execute the method in the editor when pressed.
InspectorFlagsAttribute Mark enums that represent flags with this attribute to render them using a flag drawer in the inspector.
DummyAttribute Mark a dummy field using this attribute. Dummy fields are not rendered in the inspector.
CommentAttribute Use this to add a comment above a field in the inspector.
ReadOnlyAttribute Use this to mark a field as read-only in the inspector.
LabelFieldAttribute Mark a field with this attribute to have it used as the item label in lists.
PositiveAttribute Mark integers and float fields with this attribute to have it forced positive in the inspector.
WarningIfNullAttribute Mark fields with this to show a warning in the inspector when a field is null.

Utilities

Class Description
ScreenshotTaker This component is useful for taking screen shots, either in the game or in the editor.