1. Technologies used
- NodeJS
- Unity 3D
- C#
2. Problem
For a Unity HoloLens 2 project, the resuorces had a chance of being different types, numbers and sizes according to the various factors. So, if I kept everything within the application, it would still work. But the performance and hence the user experience would be affected significantly. So I had to find a way to make it all work without compromising the performance.
3. Challenges
The solution was obvious. the resources should be kept in a server and supplied to the application on-demand. The existing solution was to make use of the existing cloud services. But that seemed like an overkill. Especially when the required options were just to upload and download the resourses as the user chooses. So, there was a need to create a small server that could be hosted anywhere and could handle the upload and download request from the user in a fast and efficient way.
4. Solution
The required resources were categorised and set to be AssetBundles. A Node JS server was created with upload function which would also replace the files if the same are updated. The server would also help the unity application download the resources which are asked by the application. A method was created to upload the new AssetBundles to the server once it is created or updated. The downloaded resources were kept in the device in a seperate directory and the application would from then on will access the data from the local device with no latency and would continue to do so as long as the file is present. If the application cannot find the file, it would send the download request to the server and download the same.
5. Result
This application size reduced as most of the heavy resources now existed as a seperate entity. The performance increases and latency was close to none. There was complete control over the application and the server as it was made in-house. Although, it was primarily designed to work with HoloLens 2, minor changes would make it possible to use within any application built by unity.
6. Links
The project was kept as two parts the server and the application.
Server
Unity Application