- Home /
Modifying a Unity game installation through code
Can Unity do it? Here's a more thorough explanation of what I'm looking for.
I'm wanting to make a game based around the premise of user generated content and user modification of the game. The goal is that the user can select mods to install from an online database and then the program can proceed to download those files and make the necessary changes to the underlying game configuration, IE moving files about and changing existing ones, so that the next time the user launches the game (s)he will be playing the modified game. This needs to be accomplished entirely through code without the need of the user or a developer to open the SDK and manually make any changes.
Does Unity have an API for programmatic access to these underlying files that would make this easier (in relative terms) to accomplish? If not, is the file structure itself organized in such a way that this wouldn't be unreasonable to accomplish even without an official API for it?
I realize this is likely a difficult question and I greatly appreciate your time. Thank you for reading.
Unity probably does not have exactly what you are looking for, but there are ways to bring in new content into Unity. See Asset Bundles.
Can an Asset Bundle be created through code? (Is there an API for doing such?)
I think the main way Asset Bundles are created is actually through code, by creating Editor scripts that allow you to save Asset Bundles within the Unity Editor. The downside is that you have to have Unity Pro and you can only create them through Unity, so your users would have to have Unity Pro to create assets themselves.
There is another way to dynamically load assets at run-time, and that is to use (or create) a model file importer. If you can live with using .OBJ files, there are a couple of importers available. If you prefer another file format, you may have to do it yourself. I did an .OBJ one myself for a project at work, it isn't too hard if you like to dig into that sort of thing.