Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Frednaar · May 03, 2010 at 03:24 PM · modding

Creating a Unity Moddable game

Hi, what is the best approach to create a game where users can create mods ? I want the users to be able to create custom mods changing scenes and assets.

I thought about using a file based system but then I might loose all Unity benefits. Alternatively user could create scenes in unity export them as packages and then I could load those scenes at runtime, but I don't know if out of project scene loading is feasible.

On the game GUI the user can load a mod from a list of mods A script will load all the assets as follows (it is a rough idea) - import meshes - load the scene data - play

Thanks Fred

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Max Kaufmann · May 05, 2010 at 08:27 PM

Unity uses .Net so users could compile their own Managed DLLs which you can load using WWW and JIT with System.Reflection.Assembly (http://msdn.microsoft.com/en-us/library/system.reflection.assembly.aspx)

However, only classes in the bootstrap unity3d file can implement MonoBehaviours, so you'll have to create a plugin host interface for your modders, e.g.

interface IMod { void OnModWasLoaded(ModHost host); void OnUpdate(); void OnModWillUnload(); ... (game specific hooks) ... }

class ModHost : MonoBehaviour { IMod userMod;

void Start() { userMod.OnModWasLoaded(this); } ... (etc, etc) ... }

There's some caveats w/r/t how you get the DLL from your host unity game for moders to link against to get the interface (the internal DLLs are in $Project/Library/ScriptAssemblies/). Simply giving them IMod.cs won't fly because .Net won't consider them the "same" class (each assembly declares an implicit namespace).

If your modders have unity they can publish and load their own asset bundles. Alternatively, you'll have to implement your own content interface.

Hope that's enough to get you started ;)

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Frednaar · May 06, 2010 at 07:59 AM 0
Share

$$anonymous$$ax, thank you for your answer. I was not thinking about users being able to create their own dll's but basically to be able to create a mod changing assets /terrains only. The project is a small flight sim (I already have the aerodynamics part) ideally the modder could add a directory in the assets folder with his terrain, meshes, and xml configuration file. Based on a GUI list selects a terrain a plane and I load everything from the X$$anonymous$$L data. $$anonymous$$y question is does this break the Unity asset management ? can I create a complete terrain, including trees, from script?

thank you Fred

avatar image
0

Answer by mvportiera · Aug 08, 2016 at 07:13 PM

If you want to give modders full control then you can make the Assembly-CSharp.dll and UnityEngine.dll from you most recent build available. Then anyone would be able to take control of the game. All you would have to do is provide an entry point and for the mods and a way to load .dll files at run time. For example you could make a mod interface as an entry point. Then when you load the .dll file you could check if a class implementing the interface exists and if so call its method. To do this however you will need to use System.Reflection and probably System.IO.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

How do I expose a folder in my build 1 Answer

How to read an OBJ file outside of unity,How do i read an OBJ file outside of unity? 1 Answer

Are we allowed to modify UnityEngine.dll and sharing it? 3 Answers

Any way to let users create scenes or prefab in one project and load them at runtime in another? 1 Answer

Game Modding Simulator Racing Game 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges