Hello Guest

Author Topic: tk2dStaticSpriteBatcher - change a tk2dBatchedSprite  (Read 4063 times)

edb

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 43
    • View Profile
tk2dStaticSpriteBatcher - change a tk2dBatchedSprite
« on: March 26, 2015, 05:23:17 am »
I'm optimizing some stuff and giving the tk2dStaticSpriteBatcher a try.
I've got some dynamically created sprites that never need to move, rotate or scale, so I'm gonna
put those in a tk2dStaticSpriteBatcher, but they do need to occasionally change color.

Can you change the color of a tk2dBatchedSprite?  Or change the material of a tk2dBatchedSprite?
If so, how do ya do it?

Thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dStaticSpriteBatcher - change a tk2dBatchedSprite
« Reply #1 on: March 26, 2015, 06:09:25 pm »
You can't change the color of a batched sprite - it will require rebuilding the entire batch which isn't efficient. You can grab the material on the batched sprite and modify it, but that will modify all of the sprites in one go.

edb

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: tk2dStaticSpriteBatcher - change a tk2dBatchedSprite
« Reply #2 on: March 26, 2015, 07:05:26 pm »
Ok - thanks!