Git Product home page Git Product logo

unity-csharp-mod's Introduction

Unity-CSharp-Mod

Native C# Modding support for Unity

This is a sample project for creating a fully moddable environment in Unity in runtime using the Mono compiler, inspired by the Cities: Skylines game's modding method.

There's a Mod Manager that searches all directories in the Mods directory for .mod files containing info about a mod bundle. It runs the Mono compiler on the mod bundle's scripts folder to produce an assembly .dll that it loads into Unity.

The .mod format is a simple JSON file with a name, description, and any dependencies needed separated by |'s.

Every Moddable object must derive from the Moddable class, which contains a TheMod variable (to get the mod it came from and details about where it's located). You can spawn each moddable object by its class name using the Spawn method in the ModManager class.

You may choose to enable compilation with the MODMANAGER_COMPILES_MODS define on your player. Otherwise, it'll only try to load the mod .dll. You need a Mono folder containing the Mono compiler (usually from your Unity installation) in the same folder as the project folder in order to compile.

You may choose to disable mod loading at runtime and instead load all mods from memory by compiling all mods into your project and adding the MODMANAGER_LOADS_FROM_MEMORY define to make the mod manager search for all Moddable Types in your Unity assemblies. This is useful in Mobile builds where you can't run the compiler.

Credits

Art by Stephen Challener (Redshrike), hosted by OpenGameArt.org Code by Nuno Silva (LittleCodingFox)

unity-csharp-mod's People

Contributors

littlecodingfox avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.