Cleaning up assets

When you first start developing with Unity, the Asset Store can be both a blessing and a curse. There are several excellent assets available in the store that can give you great strides in developing a game. However, there is often a price that comes with using too many assets, and assets that come with additional baggage like demo scenes or other packages. We discussed asset packages earlier, but here are some guidelines that will help you decide how and when to buy and/or download assets:

  • Ask yourself why you need the asset:
    • It would take too long to write your own: If you consider that most assets are priced at less than $100, it can be a compelling reason to buy, especially if the asset does a lot of things you need and you value your time. Just be sure that you need the asset, even if it's free, by following the other guidelines in this list.
    • It provides content outside your expertise: Probably, the best reason to pick up an asset is if you are new to Unity and/or game development. Ensure that you follow the other guidelines in this list, just to confirm that it makes sense to grab it.
    • It is on sale: Avoid this trap; this should be a secondary reason that perhaps makes the decision for you.
    • It has great reviews: Reviews are great, but understand the core reason why you need the asset. Even if the asset is an editor tool be mindful that it still takes up space in your project.
    • Other cool games use it: This is another trap; unless you are attempting to exactly match functionality and infrastructure, ensure that other reasons make sense.
  • Determine what support exists for the asset:
    • The asset version is compatible with your Unity version. This is a must with newcomers, as dealing with version conflicts can be a nightmare. For more experienced developers, this may not be an issue.
    • The developer supports updates to the asset. Check the asset page and make sure that the developer supports the asset. In some cases, this may be less of an issue, for artistic assets for instance. For assets with source code, this becomes less of an issue. However, high-performance or tightly integrated assets like water, terrain, and animation are something you want a developer to provide frequent updates for.
    • The reviews are favorable and current. Be sure that the asset has reviews and they are current and, of course, positive. Again, this is less of an issue for free assets because developers won't typically comment on free assets. For other assets, this can be critical. If there is any hint of issues with an asset, it is often better to avoid it.
    • The asset has a Unity forum thread. This is often a great indication that the developer is responsive to comments and bug fixes. Take a read through the posts and check the dates and type of questions. This can often give you some great insight into how the asset works and if it really will work for your project.
    • The asset provides free documentation. This is often a given now that most assets will provide a direct link to their documentation, whether you buy or not. Do a quick read through and determine if you can follow documentation and if it is something that will fit your project.
  • Review the asset package contents:
    • The asset contains plugin folders. This typically means that the asset will contain compiled libraries that may require special configuration when deploying the game. Of course, this could be an issue and something to be very aware of. Some developers may preview only the assets where they have access to all the source code. Yet this can be a trade-off sometimes, because the asset may perform dramatically better as a compiled plugin.
    • The asset contains extra content. An asset that contains additional demo files can be a great learning resource. Some assets may add the Unity Standard Asset packages or other content that could conflict with your existing assets. This may not be a reason to avoid using an asset, but it is helpful to be aware before you pull an asset into your project. It is also often more beneficial to bring an asset with a lot of demos into a test project, where you can strip down the asset to only the bare essentials and then export it for use in your project.
    • The asset content structure is well organized. Try to avoid assets that load content into multiple root folders. Not only can this be a hindrance to asset management, but it is often a sign that things that don't need to be loaded might be getting loaded'.
    • The asset content is designed for your deployment platform. This is a big one; don't expect to use content designed for a desktop on a mobile device. If the asset does not have content designed for your platform, then keep looking.
    • Asset scripts are in your preferred language. This isn't always a given and you don't want it to be a surprise. If you prefer C#, for instance, then just ensure that all the content script files end with .cs.
  • Compare the alternatives:
    • The asset has a lot of competition. This is generally a good thing for the developer, since it often indicates that the asset will be priced well for the function it delivers. It, also, most likely means that building the asset by yourself would not be worth the time. However, a competitive market can make it overwhelming to determine which asset is right for your project as there may be overlapping features and functionalities.
    • The asset has no competition. There are a few assets on the store that are so well done; they require such advanced knowledge of Unity and game development, nobody bothers to compete with them. Alternatively, the asset may be a new development concept and they are the first to release. As long as you follow the other guidelines, you can determine if the asset is a good pick.
  • Other considerations:
    • The asset is compatible with your target platforms. Make absolutely sure that the asset will work with your deployment platforms. In many cases, this can be a non-starter.
    • The asset has a free version. Anytime you see a free version of an asset, it certainly helps ease your decision. Of course, you do still need to download the asset and do all the configuration and setup for your project. Then, if you find that the asset won't work, go through the problem of removing the contents later. Be wary of free versions, in the end they may just be a waste of time.
    • The asset is a game starter pack or large framework.Starter packs and frameworks can be great, but you need to be especially careful when going down this road. Of course, this book itself develops a starter location-based AR game. Yet, in reading this book, you are quite familiar with all the nuances of the project. This may not be the case if you downloaded a completely foreign starter kit. If you plan to build your own game off a starter, do your homework and ensure that you understand the nuances of the kit.

Now that we reviewed an extensive set of guidelines gather assets for your project, we also want to cover how to clean up and remove the additional asset content that your project doesn't need. The following is a list of options to manage assets followed by a practical tip on how to easily do a basic project clean up:

  • Block unneeded content on import. If you did your homework well enough, you should have a good idea of all the items the asset is going to want to import. It is also a good practice to always import the project into a blank or test project. This should give you an idea of what content you need and what may just be used for demos. Then, when you do the actual import into your working project, you can uncheck the content you don't need.
  • A+ Assets Explorer, the paid version of this tool is reasonable and provides a good set of tools for projects with a large amount of assets, which could include most projects. This tool won't clean up assets, it will just tell you where your problems are.
  • Don't relocate imported asset content. Never relocate asset content that could be updated by the asset developer later. Moving content around will only cause problems later; when you upgrade, files may get duplicated or dropped in the wrong folders. On the other hand, if you know the content won't be upgraded, then moving it around would not be an issue. Of course, this rule also does not apply to any content that you may import manually.
  • Do a full project asset export. When your project has reached a stage where you feel it is time for a clean or you just want to remove unnecessary assets, then do a full asset export cleanup, as follows:
    1. Open your game in the Unity editor and ensure that the current scene and project are saved.
    2. Ensure that all the custom game content (scripts, prefabs, scenes, materials, and images) is in a root project folder.

      Tip

      If we use the FoodyGo project as an example, you would create a new Scenes folder under the FoodyGo folder and drag all the scenes from the Asset folder to the new Assets/FoodyGo/Scenes folder. Then, all the custom content would be under the Assets/FoodyGo folder.

    3. Select the top level custom content folder and select Assets | Export Package... from the menu, which will open the Exporting package dialog. Ensure that the Include dependencies checkbox is checked at the bottom of the form and as shown in the sample dialog, as follows:

      Cleaning up assets

      Exporting custom and dependent content

    4. Click on the Export... button of the dialog to open the Export package... dialog. Choose a good location to save your package, name it something memorable, and click on Save.
    5. Open a new instance of Unity with a clean empty project. Now, from the menu, select Assets | Import Package | Custom Package... and use the open dialog to select the file you just saved. Then, click on Open to start import of the package.
    6. After the Import package dialog opens, confirm that all the custom and some of the dependent content is there. If you didn't clean your project earlier, then the content will be measurably reduced. Click on the Import button to import the package.

Be sure to test that the full game is working as expected. At this stage, you could try doing step 5 again, but this time omitting items you are sure may not be needed. Then, retest and try from step 5 again.

Note

There are, of course, other tools and methods to reduce asset bloat. This method, however, allows you to test dependencies in isolation and at the same time, creates a backup of your game.

Effectively managing the assets in your project is a must for any game that has progressed beyond concept. Cleaning and removing unused assets is especially an exercise you will want to cover before releasing your game, and is discussed in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.97.157