What I am developing is not a game, but is done in Unity3d, so I believe here is a good place to ask.
Context:
- The unity application runs in the WebPlayer inside a web application
Case:
- User uploads a file on the website
- Webserver processes the file, does conversion and business stuff. Ends up with a DAE(Collada) file
- The DAE file that has been generated on the server needs to be loaded and shown in the Web player inside the browser of the one who uploaded it
Now, I am not very well versed in Unity, so I just want to lay out what I expect to do, and then hope to get feedback on whether that is smart, or whether there is a better approach.
So starting from top down, here's my thinking
- In order for the Web Player to find the file and use it as an asset, it should be an AssetBundle, which I can load with UnityWebRequestAssetBundle.GetAssetBundle
- that shouldn't be much trouble. If the
AssetBundle
is stored somewhere that the web app can serve it, I expect that to just work? I see in docs that Unity can load "AssetBundles from the project folder", but I don't expect that "project folder" is part of the game when loading from a URL. How would it?
- that shouldn't be much trouble. If the
- In order to generate the
AssetBundle
, I would need to have a Unity application running on the server (a headless build of unity), which would pick up the generated DAE file and use BuildPipeline.BuildAssetBundle to create theAssetBundle
and store it where the web app can serve it - The communication between browser, unity web player, web app server, and unity server instance is something I can manage on my own. I can work with sockets and jslibs to sort out my needs, so that doesn't need to be described here
- Instantiating the
GameObject
after loading theAssetBundle
into the Web Player, I expect to be simple, just following the docs for the AssetBundle
Extra credit:
- Sources for how to do the headless unity instance would be great. Sort of like a game server, but not really caring about clients connecting, but rather working with the filesystem on the server