Skip to content

3b. Exporting Custom Animations from Unity

amazeedaizee edited this page Jul 29, 2024 · 3 revisions

This section focuses on exporting Animation Clips from Unity for the purposes of importing Custom Animations to the Custom Stream Maker.

When exporting Animation Clips, make sure your Sprites for an Animation Clip contain the name of that Animation Clip, and does not contain the name of any existing animations in the game. This is important since the program searches for previews based on the Sprite's name in relation to the Animation Clip's name. (i.e. Clip name: "stream_ame_dance", Sprite name: "stream_ame_dance1" or "stream_ame_dance_1").

For this section, you need:

  • Animation Clips in Unity (if you don't have any clips yet, you can look at the Creating Custom Animations in Unity page)
    • Note: Your sprites have to be 348x227 (518x389 if using the dark stream UI) or a size using that same ratio.
  • Unity 2021.2.1f1 currently installed
  • Knowing how to click buttons
  • Knowing how to type

Exporting by Asset Bundles

If you're only creating a few Animation Clips, you can import them as Asset Bundles.

Installing the Asset Bundle Browser

First, you need to install the Asset Bundle Browser (if you haven't already) in order to do anything involving Asset Bundles. To install the browser, go to Window > Package Manager.

Then, click on the + (Add) sign and press "Add package from git URL." Type this in to install it: https://github.com/Unity-Technologies/AssetBundles-Browser.git

image

Assigning Clips To Asset Bundles

Below the Properties section, you should see a little area that allows you to assign an asset to an Asset Bundle. Add the Animation Clip to a new Asset Bundle using any name of your choosing, using the .bundle extension. (Note: Any Sprites that the Animation Clip uses, but is not explicitly added into the same bundle will be included when the Asset Bundle is built anyway.)

2023-08-22 (15)

Do the same steps to any Animation Clips that you want to include.

Exporting Your Bundles

After your done with your Asset Bundles, go to Window > Asset Bundle Manager > Build. Its also a good idea to toggle "Copy To StreamingAssets" on, so that you can easily access your bundles when building them are done.

image

If you have "Copy To StreamingAssets" enabled, you can then access your bundles by going to the StreamingAssets folder in Assets, double-clicking on your bundle then clicking "Show In Explorer".

Exporting by Addressables

If you're planning on doing a lot of Animation Clips, you can import them as Addressables.

Unity currently supports using Addressables over Asset Bundles alone. Even the game uses Addressables to load its assets.

First, you need to install the Addressables package (if you haven't already) in order to do anything involving Addressables. To install the package, go to Window > Package Manager.

Then go to Packages: Unity Registry and click on Addressables to install it.

image

You can now mark any asset as an Addressable through the upper-left corner in its Properties window.

Mark The Address

For any clips you have, your Animation Clip's Address should be "(clip_name).anim". The ".anim" extension is important, as the game can only load clips with that extension.

image

Addressable Groups

To access any asset that's labelled an Addressable, go to Window > Asset Management > Addressables > Group.

image

You can organize your clips by using Labels; just click on the empty label and either use the default or type in a new one.

You can also organize your clips by adding them into Groups. You can create a new group by clicking on New. I recommend Packed Assets as that contains some pre-loaded settings. You can click or right-click on the group name to change it.

Using Groups is useful as they will bundle as separate Addressable Bundles when all the Addressables are being built.

Building Addressables

You can build Addressables by clicking on Build > New Build > Default Build Script. Your Addressables can be found in the Library Folder of where your project is installed. ((your project) > Library > com.unity.addressables > aa > (OS) > Standalone(OS)). You can always change where your Addressables are built in the Addressable Group's Properties Window.

(Note: Any Sprites that the Animation Clip uses will be automatically included into the same Addressable Group of the Animation Clip when the Addressables are built.)

Important

Building Addressables that include the hash name in addition to the filename can be a problem later on when using them with the program. These bundles will constantly be out of sync with the program since their name constantly changes due to its hash. To fix this, go to the "Default Local Group" template in the AssetGroups folder, or click on "Default Local Group" in the Addressables window, and change "Bundle Naming Mode" to FileName in its Properties. Do the same thing with the "Packed Assets" template in the AssetGroupsTemplate folder, if you're planning on creating more than one group.

image

Conclusion

If you made it this far, your exported Bundles can now be used with the program! Maybe you also learned a bit of extra Unity too, if you're not that familiar with Unity. (I know when I started out I really didn't know what to do. Hopefully, reader, if you don't know that much about Unity, I hope this helped out a bit.)

If you want to go back to the section before this, click here.