I just discovered something that I wish I'd known a long time ago...
Referring to AnimationStates in an update loop, such as in the following code...
Code:
function Update () {
if (animation["idle"].weight == 1) {
// do stuff
}
}
... allocates massive amounts of memory each update. My first iPhone game ended up using this kind of logic quite a bit to determine animation behavior, when to play what clip, with what weight, etc. etc. Turns out it was causing the garbage collector to run overtime due to the fact that each time you use an animation state in this manner, you're burning memory. On the contrary...
Code:
var idle : AnimationState;
function Awake () {
idle = animation["idle"];
}
function Update () {
if (idle.weight == 1) {
// do stuff
}
}
...causes no runtime allocation. Just thought others might like to know.
1More
equity - How to best resolve current problems in my multiple-founder startup - OnStartu... - 0 views
1More
Partnership agreement in asymetric situation - OnStartups - Stack Exchange - 0 views
1More