Giter Site home page Giter Site logo

modtool's Introduction

ModTool mod support for Unity

Asset Store | Youtube | Forum Thread

ModTool makes it easy to add mod support to your project. It enables modders to use the Unity Editor to create scenes, prefabs and code and export them as mods for your game.

See the included examples and the Documentation for more info on how to use ModTool.

Features

  • Let modders use the Unity editor to create scenes, prefabs and code for your game
  • Scripts and assemblies are fully supported
  • Code validation
  • Supports Windows, OS X, Linux and Android
  • Mod conflict detection
  • Automatic Mod discovery
  • Asynchronous discovery and loading of mods

Limitations

  • ModTool relies on AssetBundles, which means there could be some issues if mods are created with the wrong Unity version. The exporter will check if the same version is used and inform the user if that's not the case.
  • Unity can't deserialize fields of [Serializable] types that have been loaded at runtime. This means that a Mod can't use fields of its own serializable Types in the inspector. Serializable types that aren't loaded at runtime and are part of the game do work.
  • Mods have to rely on the game's project settings. This means mods can not define their own new tags, layers and input axes. The created Mod exporter includes the game's project settings
  • Supports Unity 2017.4 and up

Acknowledgments

modtool's People

Contributors

hello-meow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modtool's Issues

File read/write problem

When I do File IO operation in Mod project, Export Mod fails and throws an exception: Verifying Project failed: System.Exception: Incompatible scripts or assemblies found

How to use ModTools namespace in my project scripts?

Hello,

In my project, I have a script that will get all loaded mods and get the prefab with a specific name from a specified mod, something like that:

Mod mod = ModManager.instance.mods.First(m => m.name == modName);
_prefabResource = mod.GetAsset<GameObject>(prefabName).GetComponent<Entity>();

But to use Mod type, I need to use ModTools namespace and from the moment I use it in my project assembly, when I export the Unity package for modding, I get this error:

Unable to resolve reference 'ModTool'. Is the assembly missing or incompatible with the current platform?

Adding ModTool to the list of API assemblies in the ModTool's settings doesn't seem the right thing to do (and it doesn't work anyway).

So how are we supposed to use the ModTool in the project scripts?

Thanks in advance for your help!

Update ModTool on the Unity Asset Store

Hi !

I noticed in this issue that the package on the Unity Asset Store is still outdated.
Last update is from Jul 23, 2019 and it prevents to add any assemblies when creating an exporter.
My first modding system had to use transform name to get data from a mod because I though we couldn't add an assembly with the exporter.

Thank you ! ModTool is a fantastic asset !

Export a dev scene and sample prefabs along with the assemblies

Hello,
I'm considering adding mod support to my game.
Your tool works great, thanks a lot for your work. <3

I'd like the modders to have a "working" scene and some prefabs samples so they can test their work in a game look-a-like environement before exporting their mod.
Is there a way to add that to the package?
Or should I re-create a package manually after the ModTool export?

Cheers!

Embbed JSON file in a MOD

Hello,

I would like to be able to include JSON files in my MOD and allow the base project read them, is there a way to do that?

From what I found, even if JSON files are present in the MOD project, they don't seem to be imported in the MOD export (not even in the asset bundle?).

How would you do that?

Thanks in advance for your answer!

Restriction Bug

Hello I Use ModTool. but users disable restrictions on Code Settings. How to disable?

[Question] What is the intended workflow for modders?

Hi there,

First of all thank you very much for this tool, it saves a lot of pain.

I have a question regarding the intended workflow for developing mods.

Currently from as far as I know, you would create a new unity project, import the exporter package, and export the mod when you are done. There seems to be no way to test the mod in the editor without exporting the mod and loading the game itself.

I assume a easier way would be to include all the necessary components for the game to run in the exporter package but that seems not ideal.

Development is an extremely iterative process and exporting the mod usually takes a fair amount of time. So I was wondering if there any easier way to speed up this process?

Thanks,
Winter

Unable to resolve the game Assembly from a mod

Hello!

First, thank you for your work on this interesting project! ๐Ÿ‘

I'm currently testing it with a small game prototype and it worked pretty easily until I tried to use code from the prototype in a mod. Now I have this error when I export the mod:

Warning: Failed to resolve assembly 'GamePrototype, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

Error: Assembly 'Assets/ModTool/GamePrototypeMod-1.0-Assembly-CSharp.dll' will not be loaded due to errors:
Unable to resolve reference 'GamePrototype'. Is the assembly missing or incompatible with the current platform?

I didn't find how to do that from the documentation, and the example doesn't use existing code, so maybe I'm doing it wrong.

In the game prototype, I have a assembly definition (GamePrototype.asmdf) file that create a DLL in the "Managed" folder of my StandaloneWindows build. I took this DLL and copied it in a "Libs" folder of a new Unity project in which I imported the Unity package created by ModTool from my GamePrototype project.

Then I've created a new script that inherits from ModBehaviour in which I used GamePrototype' specific code. The code compile so the DLL is properly linked (and automatically) to the mod project assembly.

Did I do something wrong?

Thanks in advance for your help!

Fails to import on Unity 2019.1

I'm trying to import this into a project developed in Unity 2019.1 with .Net 4.x.
I get several different errors trying to get this to work.

One for example is:

Unloading broken assembly Assets/ModTool/ModTool.Shared.dll, this assembly can cause crashes in the runtime
0x00007FF7D82E818C (Unity) StackWalker::GetCurrentCallstack
0x00007FF7D82EB641 (Unity) StackWalker::ShowCallstack
0x00007FF7D6A4AFF5 (Unity) GetStacktrace
0x00007FF7D8D0DE20 (Unity) DebugStringToFile
0x00007FF7D82436D0 (Unity) MonoManager::SetupLoadedEditorAssemblies
0x00007FF7D8235208 (Unity) MonoManager::EndReloadAssembly
0x00007FF7D82406E2 (Unity) MonoManager::ReloadAssembly
0x00007FF7D652C6B6 (Unity) ReloadAllUsedAssemblies
0x00007FF7D6526926 (Unity) HandleCompileStatus
0x00007FF7D652236A (Unity) CompileScriptsWait
0x00007FF7D6521BCA (Unity) CompileDirtyScriptsForEditorSyncInternal
0x00007FF7D6521A4B (Unity) CompileDirtyScriptsForEditorSync
0x00007FF7D6522001 (Unity) CompileScriptsForEditorSync
0x00007FF7D652A351 (Unity) LoadMonoAssembliesAndRecompileIfNecessary
0x00007FF7D6A89B38 (Unity) Application::InitializeProject
0x00007FF7D6D5DAFA (Unity) WinMain
0x00007FF7D96A653E (Unity) __scrt_common_main_seh
0x00007FFDB9EC7974 (KERNEL32) BaseThreadInitThunk
0x00007FFDBC95A271 (ntdll) RtlUserThreadStart

I tried recompiling the libraries for .Net 4.7 but that didn't help.

EDIT:
By the way, I am using Zenject which also seems to somewhat rely on Mono.Cecil.
At first I got:
PrecompiledAssemblyException: Multiple precompiled assemblies with the same name Mono.Cecil.dll included for the current platform. Only one assembly with the same name is allowed per platform. Assembly path: {0}
which I 'supressed' by deleting the Mono.Cecil in this package and using the Unity PackageManager to fetch the latest Mono.Cecil from nuget.
But that also doesn't help. I can't get ModTool to run.

ModBehaviour issue

The type or namespace name 'ModBehaviour' could not be found (are you missing a using directive or an assembly reference?)
public class test2 : ModBehaviour
It says something wrong with the mod behaviour thing

Custom data in ModInfo

It would be great if you could extend the ModInfo class with additional info your mod may need. This could be accomplished through a Dictionary<string, object> ModInfo.Extra.

Baked lightmap broken

Hi !

We're currently using ModTool (and it's a fantastic tool !) but we encountered an issue upon exporting scene with baked lightmap. When we load the scene, the terrain is entirely black. It does this only with builded game, in editor everything is fine.

Have you any idea what could cause this issue ?

Thank you in advance.

Problem with importing Exported template package again

If, on a separate project, you import everything from the "Create Exporter" tool, then make a change to it(or leave it unchanged) and try to import the package again on the same separate project, even if there are assets marked as "new", it'll say "Nothing to import! All assets from this package are already in your project."(Screenshot provided) ModTool 2.0

Desktop Screenshot 2023 12 14 - 21 41 26 29
Desktop Screenshot 2023 12 14 - 21 41 29 20

DLL's GUID changing when creating a new exporter

Hi !

We use Unity 2019.4.23f and to test the modding system of my game, I use the package created to import the new assembly in the modding project. I think it's easier for player to do it like this.
When creating a new exported to give to the player's new functionalities through the assembly it get sometimes a new GUID.

image

It only occurs once I restarted both the Unity Instance which created the export and the one which serves to create mod.
Every time I create a new exporter, this error is print in the editor's console :
image

It's really annoying because this breaks all references to scripts contained in this assembly.

image

When we set them manually Unity doesn't recognize the script and all data are lost.

image

Is there a way to prevent this to happen ? I'll continue to look for a possible fix or workaround and post it here if I find one.

Edit: I tried to uncheck Use GUIDs in .asmdef file's config but with no success as Unity can't seems to remember the change after it has been applied. (If you change inspected file and get back to asmdef the Use GUIDs is checked again...)

Cannot be used with Unity Netcode package

I love this tool and it is just very simple to use, bus as soon as I import both, the Netcode Package and the ModTool, Unity goes crazy and doesn't include the UnityEngine.UI package anymore and I get the message that the Mono.Cecil library is included multiple times. When I delete the Mono.Cecil.dll inside of the ModTool package, then I get the error that the dll is missing, although it is included via NuGet in my C# package...

TL;DR the ModTool doesn't work with the Netcode package from Unity

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.