Search Unity

Downloading DLL and assetbundle at run time in unity and start the game.

Discussion in 'Asset Bundles' started by paavann, Jan 22, 2021.

  1. paavann

    paavann

    Joined:
    Nov 21, 2018
    Posts:
    9
    Hi, I have one unity project and have several games within it. So I create asset bundle of each game and delete all the game assets except for scripts so my project doesn't become big. when I play the game I download asset bundle from server and load it and boom game starts. Now I have created DLL of game scripts and deleted all scripts and tested it, game running perfectly. So what I am thinking is to keep this DLL and asset bundle on my server and download both at runtime and then to start the game. So is it possible to do it? I create build for both Android and IOS device. Will this approach work on both platform? Any help Please.
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,031
    You can't do this for Android or iOS. First of all these are il2cpp platforms, so dlls have to converted. Also, on i2cpp platforms we use code stripping. Finally, at least on iOS, it is against App Store rules to download executable code.
     
  3. paavann

    paavann

    Joined:
    Nov 21, 2018
    Posts:
    9
    Thank you for the valuable information, android supports MONO and I am also using mono on unity 2019.4.
    In what format dll will have to be converted? If i go with mono then any way to achieve this?
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,031
    You cannot use Mono for releasing games for Android anymore. You can used it during development, but Google Play now also requires 64-bit support, which is only available when using il2cpp.
    Dlls are converted into C++ code which then compiled and linked into native .so libraries, but those aren't made for your use case, since they include engine and .NET libraries code besides script code. I don't think it's possible to make them downloadable and loadable.
     
    paavann and nilsdr like this.
  5. paavann

    paavann

    Joined:
    Nov 21, 2018
    Posts:
    9

    Thank you very much for the detailed answer, I really appreciate it. So is there any other way other than DLL to achieve this functionality (downloading code at runtime and link it to assetbundle )?
     
unityunity