#Distribute code as mods to android

1 messages · Page 1 of 1 (latest)

opaque gazelle
#

I have a modding system, I programmatically create an assetbundle, and a DLL(s) based on the assets/scripts in a certain scene. This works fine for Windows, but I can't get the DLL to work for Android (builds the bundle fine though) - code below

private void DoScriptOnlyBuild(string destination, IEnumerable<string> managedAssemblyNames, string bundleName, bool ecsOrBurst)
{
    var bpo = new BuildPlayerOptions()
    {
        locationPathName = Path.Combine(destination, "__build", "plugin"),
        target = _environmentType == EnvironmentType.Windows ? BuildTarget.StandaloneWindows64 : BuildTarget.Android,
        options = ecsOrBurst ? BuildOptions.DetailedBuildReport : BuildOptions.DetailedBuildReport,
        subtarget = (int)MobileTextureSubtarget.Generic, //Tried this too, didn't work
    };

    Debug.Log($"Prepare to build..");
    //This should create a bunch of DLLs, we then cherry pick the ones we need for the mod using the managedAssemblyNames list
    BuildReport report = BuildPipeline.BuildPlayer(bpo); //Doesn't generate DLL!

While, on Windows, this creates a DLL perfectly fine, this doesn't seem to happen when targeting android. There are no logs in the console (except for a warning about not being able to parse XML with no further info, but people on the forums say they get this even on healthy builds) The build report tells me nothing useful.

I'm also able to build the entire project to android just fine via the standard unity build button, this of course creates an APK though rather than a bundle/dll

Any ideas?

Cheers,
Fred

fading loom
#

is android set to use mono and not il2cpp? il2cpp doesn't create managed dlls but only native code.

opaque gazelle
#

That's good to know - regardless, it doesn't seem to generate any native dll either, I would expect a lib_burst_generated.dll file to appear in my output folder ("__build/Plugin"), instead, strangly, I have a __build folder, with a file called "plugin", and a file at BurstDebugInformation_DoNotShip\tempburstlibs\arm64-v8a called lib_burst_generated.txt

opaque gazelle
fading loom
#

may not be supported then for android. Perhaps if you have it only make an android studio project and have mono selected you can grab some dlls from that?

opaque gazelle
#

Ah that's not really the workflow we want for our modders, for windows we have a nice clean button in the editor that just does it for you..

I feel like the fact you can even do

var bpo = new BuildPlayerOptions() { locationPathName = Path.Combine(destination, "__build", "plugin"), target = BuildTarget.Android, }; BuildReport report = BuildPipeline.BuildPlayer(bpo);

Suggests that trying to build to android here should really do something

fading loom
#

I don't know any more thank you. I do remember android dev builds had some code patching thing at some point but i dont know much else

buoyant bramble
#

you can't practicably distribute mods to android devices that introduce new code.