Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Ironic Chef on May 24, 2016, 07:17:40 PM

Title: Suggestion for UISpriteAnimation
Post by: Ironic Chef on May 24, 2016, 07:17:40 PM
I recently needed to have a number of animated sprite objects that used the same looped animation appear side-by-side, but also needed for them to not appear to be identical. I accomplished this by adding a "SetFrame" method to your UISpriteAnimation class that simply changes the value of "mframe" to a specified index. That amounted to three lines of code that allow a UISpriteAnimation to start playing at a different frame. The addition allowed me to alter which frame the animated sprite started at, and made the multiple sprites appear to present different animations using identical frame data.

I really think this is a method that should be added to the UISpriteAnimation class going forward. Currently there is no way to specify the frame on which the animation playback commences. I understand that it's an edge-case issue, but it really is just a few lines of code that extends the functionality of the class in a significant way.
Title: Re: Suggestion for UISpriteAnimation
Post by: ArenMook on May 26, 2016, 11:18:10 AM
Wouldn't it just be easier to make the index public instead?
Title: Re: Suggestion for UISpriteAnimation
Post by: diederik on August 23, 2016, 04:14:03 AM
Hi guys,

I saw that this feature was added in 3.9.9. I'm using 3.10.0
I'm not actually using this particular functionality, but I got a warning...

Unable to find property frame
UnityEngine.Debug:LogWarning(Object)
NGUIEditorTools:DrawProperty(String, SerializedObject, String, Boolean, GUILayoutOption[]) (at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:1483)
NGUIEditorTools:DrawProperty(String, SerializedObject, String, GUILayoutOption[]) (at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:1438)
UISpriteAnimationInspector:OnInspectorGUI() (at Assets/NGUI/Scripts/Editor/UISpriteAnimationInspector.cs:27)
UnityEditor.DockArea:OnGUI()

Looks like the issue was not implemented correctly or not synced between UISpriteAnimation and UISpriteAnimationInspector.
(using the name 'frameIndex' and 'frame')
Was easy to fix though. Just wanted to check if this might need fixing for a future version.

Cheers,

Diederik

Title: Re: Suggestion for UISpriteAnimation
Post by: ArenMook on August 24, 2016, 02:09:01 PM
Thanks, Diederik. I'll fix it on my end.