Extension Method Library (and useful tools)

Code and Unity Package

Source Code Download

Extension Methods

Description

The Extension Methods are used to extend the functionality of Unity Components and C# Classes that are closed to modification without having to make a wrapper.

Class Extends Extensions
ListExtension.cs List 10
MonoBehaviourExtension.cs MonoBehaviour 1
NavMeshPathExtension.cs NavMeshPath 1
QueueExtension.cs Queue 3
StackExtension.cs Stack 3
StringExtension.cs string 6
TransformExtension.cs Transform 3
Vector3Extension.cs Vector3 3
ColorExtension.cs Color 1

Useful Tools

DebugDev
Description

Logs a message to the Unity Console. Works really well with the StringExtension.cs of the library.

Uses the Scripting Define Symbols to activate and deactivate all the logs if you need it. You have to add DEV_LOG to the Configuration (how to add it) and use the DebugDev.DevLog() method.

At this moment, it uses Debug.Log internally to show the content of the string, therefore it has the same features (concatenation of strings, Rich Text, context argument, etc.) and more features that Debug.Log() doesn't have. You can read more in the official DebugDev documentation is here, and if you need the Debug.Log() documentation you can find it here.

Documentation

Gitlab

Examples
              
 // Show in Unity Console the message.             
 DebugDev.Log("Hello world !");

 //Shows in Unity Console the message in color.
 DebugDev.ColorLog("Hello world !", Color.red);

 //Shows message if the DEV_LOG symbol is added.
 DebugDev.DevLog("Hello world !");

 //Shows message in color if the DEV_LOG symbol is added.
 DebugDev.DevColorLog("Hello world !", Color.red);
              
            
Roadmap

Remove the UnityEngine.Debug.Log() dependency injecting the dependency by parameter. .

SerializableVector3
Description

Representation of 3D vectors and points in a class that can be serialized to a database or file. It's not a replace for Vector3 struct, it's just a way to save the Vector3 data. Works really well with the Vector3Extension.cs of the library.

It has the most important functionality of the Vector3 struct (default vectors, SqrMagnitude(), Magnitude(), operator overload, Normalize(), Equal(), etc) and you can transform the Vector3 into a SerializableVector3 and vice versa using the Vector3Extension.cs extension methods. The complete documentation is here.

Documentation

Gitlab

Examples
                
// Creates a new SerializableVector3.             
var serializableVector3 = new SerializableVector3();

// Creates a new SerializableVector3 with values.             
var serializableVector3 = new SerializableVector3(1,2,3);

// Creates a new SerializableVector3 with values (0,0,1).             
var serializableVector3 = SerializableVector3.forward;

// Creates a new SerializableVector3 with values (1,1,1).             
var serializableVector3 = SerializableVector3.one;
                
              
Up

Alexis Polak - Software Engineer

Follow @alexispolak