Gamelogic Extensions
Pattern Classes
- Singleton: The classic Unity singleton for providing global access to certain MonoBehaviours.
- Pools: Classes for reusing objects, with optimizations for hashable objects. Designed to build custom pools from.
- StateMachine: Class for managing states and methods that should execute when states change or as it persists. Designed to build custom state machines from.
- PushdownAutomaton: A state machine that remembers past states and can transition back to them FIFO-style.
- Clock: Class for executing once-of or regularly timed events. Includes an event for seconds to make clock UIs easier to implement.
- ImplementationFactory: Class for creating objects from generic parameters, especially useful for testing different implementations of the same interface. Can serve as the basis for a service locator.
- ValueSnapshot: Class for representing a value and previous value.
- ObservedValue: Class for raising events when a value changes.
- Optional: Types to indicate optional values in the inspector.
- StateTracker: Classes for raising events when sets of operations complete.
Data Structures and Algorithms
- Collection extensions: Provides useful extension methods for collections, lists, enumerables, and arrays.
- RingBuffer: A ring buffer implementation.
- Generators: Objects that work like random generators, but not random. Useful for creating patterns, or random values with elaborate constraints.
- ResponseCurve: Represents a piecewise linear function from float to any “continuous” type. Ships with response curves for float, Vector2, Vector3, Vector4, and Color.
- PIDController, Differentiator, Integrator: classes for doing PID control.
- Combinatorial algorithms: Class for generating combinations, permutations, the power set, and partitions of a set.
- L-System: Supports rewriting strings using rules that can be the basis of certain procedural generation algorithms.
Extensions
- PlayerPrefs: Adds support for bool and array types, and for scoping.
- MonoBehaviour: Provides convenience methods such as Instantiate, Invoke (using actions), Tween, GetRequiredComponent, DestroyUniversal, and Clone.
- GameObject: Provides GetRequiredComponent.
- Transform: Provides convenience methods for common transformations, useful lazy enumerables.
- Vector: Provides methods to get a copy of a vector with some coordinates changed, conversion methods from 2D to 3D, methods for basic transformations, “projection and rejection operations, the perp dot product, and Hadamard multiplication and division.
- Color: Provides convenient methods to get a color lighter, darker, or with specified brightness or alpha value.
- Math: Provides division and modular operations that work correctly with negative numbers, methods for getting fractional value or sign, and methods for doing circular lerping.
- Debug: Provides a way to add a label to messages, useful when working with console extensions such as Console Pro.
- Image: Adds SetAlpha and Set Visible methods.
Editor Extensions
- Useful decorators and property drawers: Comment, Dummy, Highlight, Flags, Labels, NonNegative, Positive, and WarningIfNull.
- FieldTypes: List (more usable than older Unity lists), MinMaxFloat, and MinMaxInt.
- Inspector buttons: Turn methods into buttons that display at the bottom of a component.
- GLEditor: Convenient base class for editors.
Utilities
- ScreenshotTaker: Capture screenshots in both the game and the editor effortlessly.
↗️ Documentation
↗️ Samples
↗️ Support
↗️ Blog
Check out our other assets
Release Notes
Version 4.6.0
⚙️ Editor Improvements
- A startup wizard makes it easier to import samples and find documentation, email support and uninstall instructions.
- The same features are also added to menus Tools/Gamelogic/Extensions/.
🎉 New Features
- Added Gamelogic.Extensions.ObservedTransformedValue.TransformedValue property
- Added Gamelogic.Extensions.ThrowHelper.ThrowIfNotPositive
- Added Gamelogic.Extensions.ThrowHelper.ThrowContainerEmpty
- Added Gamelogic.Extensions.ThrowHelper.ThrowContainerFull
- Added Gamelogic.Extensions.ThrowHelper.ThrowIfEmpty
- Added Gamelogic.Extensions.ThrowHelper.ThrowIfNull
- Added Gamelogic.Extensions.ThrowHelper.ThrowIfNullOrEmpty
- Added Gamelogic.Extensions.ThrowHelper.ThrowIfNullOrWhiteSpace
- Added Gamelogic.Extensions.ThrowHelper.ThrowIfNotAssignableFrom
- Added Gamelogic.Extensions.TextureTilingBase
- Added Gamelogic.Extensions.TextureTiling
🐞 Bug Fixes
- Fixed a bug in Gamelogic.Extensions.Algorithms.Generators.Iterate .
- Fixed Gamelogic.Extensions.Algorithms.CollectionExtensions.TryLast .
- Fixed Gamelogic.Extensions.Algorithms.Capacity2Buffer.
- Fixed Gamelogic.Extensions.TransformExtensions.FlipXYZ.
- Fixed Gamelogic.Extensions.TransformExtensions.ScaleByXYZ .
- Fixed Gamelogic.Extensions.TransformExtensions.SetLocalXZ .
- Fixed the Vector3 overload of Gamelogic.Extensions.VectorExtensions.Proj.
- Fixed the Vector4 overload of Gamelogic.Extensions.VectorExtensions.Proj.
- Fixed Gamelogic.Extensions.MatrixFloat.IsValid.
- Renamed DummyPorpertyDrawer to Gamelogic.Extensions.Editor.DummyPropertyDrawer.
- Removed DiskCache which had no implementation.
📄 Documentation
- Updated documentation fixing typos, errors, and missing entries.
🧪 Samples
- Renamed Gamelogic.Extensions.Tree to Gamelogic.Extensions.PineTree to avoid conflicts with Unity's Tree.
Version 4.5.0
🎉 New Features
- Added Gamelogic.Extensions.ObservedTransformedValue
- Added Gamelogic.Extensions.ObservedThreshold
- Added Gamelogic.Extensions.KeyValue
- Added Gamelogic.Extensions.Texture2DTiling
- Added Gamelogic.Extensions.FixedKeyDictionary
- Added Gamelogic.Extensions.EnumDictionary
- Added Gamelogic.Extensions.InspectorTextAttribute
- Added Gamelogic.Extensions.SceneNameAttribute
- Added Gamelogic.Extensions.PresetsAttribute
- Added Gamelogic.Extensions.MatrixFloat
- Added Gamelogic.Extensions.ReuseCandidateAttribute
- Added Gamelogic.Extensions.ReadMe
- Added Gamelogic.Extensions.Algorithms.CollectionExtensions.Apply
- Added Gamelogic.Extensions.Algorithms.CollectionExtensions.Median
- Added Gamelogic.Extensions.Algorithms.CollectionExtensions.MedianPartition
- Added Gamelogic.Extensions.Editor.PropertyNotFoundException
- Added Gamelogic.Extensions.Editor.SerializedPropertyExtensions
- Added Gamelogic.Extensions.Editor.SceneUtilities
- Added Gamelogic.Extensions.Editor.GLEditorGUI.Header
- Added Gamelogic.Extensions.Editor.Texture2DTilingPropertyDrawer
- Added Gamelogic.Extensions.Editor.ListSelectionPopup
- Added Gamelogic.Extensions.Editor.MatrixFloatPropertyDrawer
- Added Gamelogic.Extensions.Editor.KeyValuePropertyDrawer
- Added Gamelogic.Extensions.Editor.FixedKeyDictionaryPropertyDrawer
- Added Gamelogic.Extensions.Editor.SceneNamePropertyDrawer
- Added Gamelogic.Extensions.GLMathf.Sqr
- Added new tool Tools/Gamelogic/Rename/Sequential From 0
- Added new tool Tools/Gamelogic/Rename/Sequential From 1
Version 4.4.2
🐞 Bug Fixes
- Fixed a bug where there was a conflict between the Gamelogic.Extensions.Support.MustDisposeResourceAttribute and the one in certain versions of JetBrains.Annotations.
Version 4.4.1
🐞 Bug Fixes
- Fixed various issues related to editor code being included in builds. The following classes were affected:
- Gamelogic.Extensions.Editor.Internal.Asset (Note: this class has also moved namespaces.)
- Gamelogic.Extensions.LayerPopupAttribute
- Gamelogic.Extensions.TagPopupAttribute
🧪 Samples
- Fixed issues related to editor code being included in builds. The following class was affected:Gamelogic.Extensions.BuildScenePopupAttribute
- Gamelogic.Extensions.Samples.ValidatePowerOfTwoAttribute had a bug where the compiler directives were misplaced, causing build errors.
Version 4.4.0
🎉 New Features
- Added Gamelogic.Extensions.PropertyDrawerData.SeparatorColor and Gamelogic.Extensions.PropertyDrawerData.SeparatorHeight to Gamelogic.Extensions.PropertyDrawerData to allow for customizing the appearance of separators.
- Added various grays in Gamelogic.Extensions.Support.Branding and Gamelogic.Extensions.Support.Branding.Hex.
🐞 Bug Fixes
- Fixed the constructors of Gamelogic.Extensions.SeparatorAttribute to avoid the ambiguous call when trying to use the default constructor.
- Re-added a constructor for Gamelogic.Extensions.WarningIfNullAttribute that takes a string message. (Note: the class is obsolete but retained for backwards compatibility. In the last update, the constructor that takes a string message was accidentally removed.)
- Renamed Gamelogic.Extensions.NotNegativeAttribute to Gamelogic.Extensions.NonNegativeAttribute, restoring the class's original name. (Note: the class is obsolete but retained for backwards compatibility. In the last update, the class was accidentally renamed.)
Version 4.3.0
🎉 New Features
- Added Gamelogic.Extensions.VectorExtensions.ClampMagnitude.
- Added Gamelogic.Extensions.Support.Assets.FindByType.
- Added methods to convert between colors and hexadecimal strings: Gamelogic.Extensions.ColorExtensions.TryParseHex, Gamelogic.Extensions.ColorExtensions.ParseHex, Gamelogic.Extensions.ColorExtensions.ToRGBHex, Gamelogic.Extensions.ColorExtensions.ToRGBAHex.
- Added a common base class for properties that validate their values: Gamelogic.Extensions.ValidationAttribute, and added different ways to do the validation through flags in Gamelogic.Extensions.PropertyDrawerData.
- Added Gamelogic.Extensions.ValidateNotNullAttribute, Gamelogic.Extensions.ValidatePositiveAttribute, Gamelogic.Extensions.ValidateNonNegativeAttribute, Gamelogic.Extensions.ValidateMagnitudeRangeAttribute, and deprecated Gamelogic.Extensions.WarningIfNullAttribute, Gamelogic.Extensions.PositiveAttribute, Gamelogic.Extensions.NonNegativeAttribute.
- Gamelogic.Extensions.HighlightAttribute now supports a color parameter and is drawn better in the non-pro skin of Unity.
- Gamelogic.Extensions.WarningIfNullAttribute now supports a color parameter.
- Added Gamelogic.Extensions.PropertyDrawerData that can be used to set global properties used by property drawers, such as default colors and list retrievers.
- Added property drawer support for drawing popups of various types, including strings, integers, colors, tags, and layers. See subclasses of Gamelogic.Extensions.PopupListAttribute and Gamelogic.Extensions.Editor.PopupListPropertyDrawer.
- Changed all relevant MonoBehaviours and ScriptableObjects to use the new validation attributes.
- Added Gamelogic.Extensions.SeparatorAttribute and Gamelogic.Extensions.Editor.SeparatorDrawer to draw separators in the inspector.
- Added Gamelogic.Extensions.Support.SuppressReason that has justifications for suppressing certain warnings, and deprecated Gamelogic.Extensions.Support.Warning.Added Gamelogic.Extensions.Support.Branding.HexColors to provide string presentations of colors, and added Gamelogic.Extensions.Support.Branding.White and Gamelogic.Extensions.Support.Branding.Black for consistency.
- Added Gamelogic.Extensions.Internal.EditorOnly to mark symbols only available in the editor.
🐞 Bug Fixes
- Made Gamelogic.Extensions.ThrowHelper.ThrowIfNegative an extension method, like the other extension methods in this class.
🔧 Engineering
- Made Gamelogic.Extensions.InspectorList and all its subclasses obsolete for Unity 2020.1 and later, since Unity's new list provides similar (and more robust) functionality.
🧪 Samples
- Fixed warnings in the Generators sample.
- Expanded the Property Drawers Example to include all the new changes.
- Changed all relevant samples to use the new validation attributes.
📄 Documentation
- Added documentation for attributes used in property drawers.
- Expanded the documentation for Property Drawers.
Version 4.2.1
- `Gamelogic.Extensions.ObservedValue` was accidentally moved to the wrong name space in a previous release. It has been moved back to `Gamelogic.Extensions`.
Version 4.2.0
- Added new algorithms (RandomAccessQueue, RandomAccessPriorityQueue, IReadOnlyBuffer.Item and more).
- Added branding support to make it easier to make examples have a consistent look and feel.
- Replaced IndexPriorityQueue with RandomAccessQueue.
- Added a more complex generators example to show how they can be used for procedural generation, and restructured the existing two example into folder.
- Added a `Gamelogic.Extensions.MinMaxInt` to the property drawers sample.
Version 4.1.0
- Added a ring buffer data structure and related classes.
- Added classes to implement PID control.
- Fixed various multiple enumeration issues.
- Fixed warnings related to the pool samples and FPSCounter.
- Improved pool documentatio.
Version 4.0.0
- Added new data structures.
- Added new math methods.
- Added an experimental FPS counter to be used in example benchmarks.
- Made the minimal pool example more compelling.
- Added a pool benchmark example.
- Added scripts that show how the pool types can be used to build more sophisticated pools.
...