Plugin script loading

Hello guys!

We are working on a game with an extensive plugin-architecture where you can select from a list of different games with some of them preinstalled (the game itself is standalone Mac/Win) and some of them downloadable.
Since we want to develop additional games when the main application is released, it is necessary to load additional content, including scripts into the application.

I have already set up some kind of pipeline to export the games, but when I tried to load one of the games my collegue developed and exported on his machine, I got a crash. Now I think the reason is, that the main application compiles all the scripts it knows into the .net assemblies, but if there is some additional scripts that are not known at build time of the main app, unity does not know how to handle it. So we will have to compile the additional code into seperate dlls and write a dll loader for the main application to load these additional dlls if necessary.

So the question is, if you can confirm the thoughts stated above? I would just like to know that my assumptions are right before I start to write a dll loader :slight_smile:

Thank you so much in advance,

phensch

Hello again!

Just to clarify the question: We use the BuildPipeline.BuildPlayer function to export our levels and load them as shown in the AssetBundles example, using BuildOptions.BuildAdditionalStreamedScenes.

Is it right, that in this case, there are no scripts are included in the .unity3d package and you cannot use scripts inside if they are not included into the standalone application?

In our case, we set up a interface for loading additional games, which are developed on another Mac and perhaps after release of our standalone for download via internet, so it is possible that when building the standalone not all scripts needed for the games can be included.

Or am I wrong and there is a way to include additional scripts into the Streamed scenes?

Please help me! Thank you!

phensch

If you want dynamic updating of code you are gonna have to code the class loading your self using C# class loading capabilities. There are several examples of this on the internet often referred to as plugins.

Here is one example: