Author Topic: UISpriteAnimation, programmatically changing NamePrefix  (Read 2953 times)

Tranas

  • Guest
UISpriteAnimation, programmatically changing NamePrefix
« on: May 10, 2013, 05:58:05 PM »
So, I'm having an issue with UISpriteAnimation.
I'm not really trying to do anything complicated with it, as I am aware it's just for simple animations.

But I need to swap between different namePrefixes on the fly during Runtime.

            _gestureSprite.namePrefix = ArTypes.Sprites.GESTURE_SPRITE_REFERENCES[(int)module.moduleType];
            _gestureSprite.Reset();

Where _gestureSprite is a UISpriteAnimation reference and GESTURE_SPRITE_REFERENCES is a string array of NamePrefixes.
They're all stored in the same atlas as well, so it should just be able to find them by the prefix and loop through.

The problem is, the second I try to switch between them at Runtime with this code, it doesn't change sprite and won't animate any longer.
But before that, if I do it through editor - it will find them and animate just find.

I've searched through the forms and surprisingly can't find anyone who is trying to swap namePrefixes at runtime.
So I plead to your assistance.

Thanks again!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISpriteAnimation, programmatically changing NamePrefix
« Reply #1 on: May 11, 2013, 01:07:55 AM »
It's likely something obvious -- like case sensitivity. The prefix is case-sensitive. Put a Debug.Log inside UISpriteAnimation.RebuildSpriteList after it compiles the list. My guess is that it's coming out empty.