- Home /
Animations loading on Android requires double memory size.
Hello!
We use Unity 3.5.2 There are 900 animations, that are stored in «Resources» folder. If we add these animations to the scene in a static way, they take up 30MB RAM. There is an empty scene. The scene contains only «Main Camera» with the script Loader, that loads these animations.
Here is this script:
using UnityEngine;
using System.Collections;
public class Loader : MonoBehaviour
{
Object[] anims;
void Start()
{
anims = Resources.LoadAll("Animations", typeof(AnimationClip));
}
}
After such dynamic animations loading, the memory size, taken up by application for Android, increases not by the expected 30 MB, but 60 MB!
And it does not decrease up the supposed size, until Resources.UnloadUnusedAssets()is called.
The situation does not change even if the following is done:
· to load animations one by one through the Resources.Load() method.
· to load animations not in Start(), but in Update()
· to load animations not to the array, but to the component Animation
· to load not animations, but a prefab with a list of these animations
If adding a prefab with this animations to the scene statically, memory requirements will increase only by the supposed 30 MB.
We have used Galaxy Nexus (Android 4.0.2) and Galaxy Tab 10.1 (Android 3.1). Memory measurements have been performed via SystemPanelLite. The problem re-occurs only on Android – on iOS and PC there is no such problem.
How to solve this problem? Thanks!