MathsEngine is a modular, node-based math evaluation system for Unity. Define any mathematical formula as a reusable ScriptableObject graph and evaluate it at runtime with a single line of code — no hardcoded logic, no formula spaghetti in your MonoBehaviours.
Whether you're building RPG damage calculations, AI scoring, procedural generation curves, or physics rules, MathsEngine keeps your math clean, inspectable, and entirely designer-friendly.
☄️ HIGHLIGHTS ☄️
– Node-Based Formula Graphs – ScriptableObject-Driven – Runtime Parameter Support – Live Equation Preview – Arithmetic, Trig, Utility & Random Nodes – AnimationCurve Integration – Unity Time Nodes – Fully Extensible Custom Nodes – Package Manager (UPM) Ready
• Node-Based Formula Graphs: Build complex expressions by composing small, reusable nodes into a tree. Nodes reference other nodes as inputs, and the graph evaluates from root to leaf to produce a single float result.
• ScriptableObject-Driven: Formulas are stored as MathFormula assets in your project. Tweak values directly in the Inspector without touching code — ideal for designers and non-programmers.
• Runtime Parameter Support: Pass dynamic values — player stats, enemy attributes, game state — into any formula at runtime using a simple variadic API: float result = formula.Calculate(playerAttack, enemyDefense);
• Live Equation Preview: Every formula auto-generates a human-readable equation string via ToEquation(), displayed directly in the Inspector for instant debugging and validation. e.g. (5 + 3) * 2 = 16
• Rich Built-In Node Library:
• Fully Extensible: Create custom nodes by subclassing BaseMathNode and implementing Calculate() and ToEquation(). Custom nodes integrate into any MathFormula graph with no additional setup.
• UPM Ready: Installed directly via Unity Package Manager using a Git URL — no .unitypackage import required.
☄️ REQUIREMENTS ☄️
Unity Version: Compatible with Unity Package Manager (UPM). Minimum tested version not yet officially specified — verify against your project's Unity version before installing.
Dependencies: No third-party package dependencies. Relies solely on built-in UnityEngine APIs (Mathf, AnimationCurve, Time, Random).
Scripting Backend: Compatible with both Mono and IL2CPP.
Render Pipeline: No render pipeline dependency. This is a pure runtime/logic package — compatible with Built-in, URP, and HDRP.
Platform Support: No platform-specific restrictions. Pure C# runtime logic runs on all Unity-supported platforms.
☄️ INSTALLATION ☄️
📖 Documentation: https://arijeetbaruah.github.io/Maths-Engine/