Hello Guest

Author Topic: Changing Sprite Alpha Colour using Unity Animation key-frames  (Read 48093 times)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Changing Sprite Alpha Colour using Unity Animation key-frames
« Reply #15 on: April 12, 2014, 05:09:07 am »
No, there is no update or a better solution to this.

AbsurdInteractive

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Changing Sprite Alpha Colour using Unity Animation key-frames
« Reply #16 on: June 13, 2014, 03:42:23 am »
We have this tk2dAnimationAdapter script on a Sprite in our scene, and when we run it on iOS and  look at the profiler it says this script takes up 25% of the game loop. IS there something we're doing wrong with this script? I thought it was just to modify animation color of sprites and text in Unity animations.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Changing Sprite Alpha Colour using Unity Animation key-frames
« Reply #17 on: June 13, 2014, 08:23:30 am »
This script is expected to be rather expensive as it has to continuously poll everything every frame. Thats the reason why it isn't in the actual script itself. Until unity provide a better way to be notified of animation changes (no you cant animate c# properties still) there will be no way to make this appreciably faster.

cheesus

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Changing Sprite Alpha Colour using Unity Animation key-frames
« Reply #18 on: July 03, 2014, 04:28:17 pm »
I've been keeping an eye on this issue & its worrying that there has been no progress in (i think) well over a year now from unity or tk2d. At some point (soon i think) i want to be able to animate the colors of a lot of sprites & the ideal way to do it is with a tool like unitys animation system with scrubbing, editor preview but more importantly all in the same place -  ie a singe animation that controls multiple animating things, its just the way animation on computers is done no?

I dont know if I dreamed it or not but did the 'legacy'  animation system support animating tkd2's sprite colors? I do know its now broken as far as animating material colors goes & its been dropped from development so I probably want to avoid it anyway, i mean check this out its unbelievable that no. 6 on the issue tracker is 'broken by design': http://issuetracker.unity3d.com/issues/cant-animate-color-value-of-materials

I would like to know if the following statements describe the state of play right now:

 - Unitys animation system only works with Unity sprites if you want to animate colors and gained a competitive advantage over tk2d either by design or accident for its built in 2d system from its initial release to present.

- If I want to stick with tk2d and use use the adapter scripts I will pay a price in performance over using unity sprites.

Now naturally I want to stick with tk2d as much as possible, i mean i'm fully expecting a dev to reply to this -  try posting a similar thread in the unity forums I would expect a wall of silence - but after reading this
Quote
Until unity provide a better way to be notified of animation changes (no you cant animate c# properties still) there will be no way to make this appreciably faster.


I would advise strongly against waiting for the the unity team to deliver the goods.

Could tk2d 'fake' unity sprites somehow? Using the sprite renderer component to get access to the animation system? Or has anyone suggested creating your own animation system? I'm sure whatever unikron came up with would be more steamlined, efficient but mostly better supported than unity's :)


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Changing Sprite Alpha Colour using Unity Animation key-frames
« Reply #19 on: July 03, 2014, 05:47:51 pm »
The state of things right now
- the animation system doesn't animate c# properties = no way to animate tk2d sprite properties like color
- we cant feed custom mesh data into a sprite renderer, which makes that approach a non-starter
- adapter scripts are one option, you could possibly make them more efficient by having one global watcher dealing with this. This is going to be very specific to a use case, though. I can offer some ideas on what to do to speed this up, but it'll mean writing some code to deal with this.

I dont expect that Unity is going to change this anytime soon. However, I don't have the budget to create an animation system. It would be the ideal solution, but not something that I can pursue.

cheesus

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Changing Sprite Alpha Colour using Unity Animation key-frames
« Reply #20 on: July 03, 2014, 06:40:26 pm »
thnx for the info...pm sent!

moofly

  • Guest
Re: Changing Sprite Alpha Colour using Unity Animation key-frames
« Reply #21 on: March 02, 2016, 12:27:49 pm »
I've been using the above script and it works perfectly with one exception.  It doesn't do anything to tk2dSlicedSprite's - how can I make it work with sliced sprites?

moofly

  • Guest
Re: Changing Sprite Alpha Colour using Unity Animation key-frames
« Reply #22 on: March 02, 2016, 12:50:48 pm »
No, wait, I think I've realised my error.  The script is fine, I just needed to change the animation to animate a tk2dSlicedSprite rather than a tk2dSprite.  Silly me.