Makinom can use assets from different sources, e.g. direct references or asset bundles.
Assets like prefabs, audio clips or textures, but also Makinom’s own data assets can come from different sources – every source has their own benefits and drawbacks. Makinom supports assets from different sources and can switch between different sources for all assets in your project with a single button click in the Makinom editor.
Asset Sources #
The following asset sources are currently available – the system can be extended by custom scripts by deriving from the BaseAssetSource<T> class. Check out the available asset source scripts to see how this can be implemented.
Uses a direct reference to the asset and stores it in the Makinom project (or event asset). This is the default and easiest way to use an asset, as it’ll be available in your built-game without any additional work.
The main drawback with direct references, especially in larger projects, is that all references stored in the Makinom project will be loaded into memory when Makinom is initialized with the game starter, as Unity will simply load all references of an asset. This can lead to long load times for the scene that contains the game starter and huge memory allocations.
Please note that most data assets you set up in the editor are not referenced by the project (unless they’re selected somewhere). Only certain special data that needs to be available at all time (e.g. input keys, UI boxes and HUDs) are directly referenced by the project and will be loaded upon initializing Makinom.
Uses assets that are stored in a Resources folder in your Unity project (needs to be somewhere in the Assets folder) and only saves the path of the asset within the folder. Everything in a Resources folder will be added to your built game. Moving or renaming an asset while it’s stored as a Resources asset will lead to losing the asset setup. If a selected asset isn’t stored in a Resources folder, the asset field will be reset (i.e. no selected asset).
While Unity doesn’t recommend using Resources folders (learn more about this here), it’s still an easy way to reduce load time and memory issues coming from direct references and can be useful.
Asset Bundle #
Uses assets that are part of asset bundles. Selecting an asset will automatically define the asset name and asset bundle settings with the asset’s information. If a selected asset isn’t in an asset bundle, the asset field will be reset (i.e. no selected asset).
The asset bundle’s path defines where the bundle will be loaded from in the running game. Currently, asset bundles are only loaded from file, i.e. not loaded or streamed from the web, so your asset bundles need to be deployed with your game or downloaded before they’ll be available.
You can download a simple script that will build all asset bundles into the Streaming Assets path here. The script adds 2 new menu items to Unity’s Assets menu – Build AssetBundles will build all asset bundles in your project without any build option, Build AssetBundles Uncompressed will build all asset bundles uncompressed. I’d recommend building uncompressed bundles if you include them in your built game, as this increases the time needed to load them (since Unity doesn’t need to decompress them first).
Everything in the streaming assets path will be added to your built game, so this is a good way to use asset bundles without having to worry about downloading or streaming them to get them into your game. Learn more about asset bundles, how to set them up and how to use them in the Unity manual.
Asset Settings #
The asset settings can be found in Game > Game Settings in the Makinom editor. You can define some basic settings here, e.g. the default path from where asset bundles will be loaded or if resources and asset bundles should be unloaded when changing scenes.
The main usage is the ability to change between different asset sources in your project and event assets. This allows you to e.g. use references while in development and switch to using asset bundles when getting ready to build your game for deployment. Changing asset sources in the project only changes those assets that support the used source, e.g. if an asset is part of an asset bundle, the asset field would automatically update to use the asset bundle the asset is stored in – otherwise, the asset would stay as a reference (or whatever source it currently had).