Hello Guest

Author Topic: Rebuild collection item names with tk2dSpriteCollectionBuilder  (Read 4039 times)

schmoey

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Rebuild collection item names with tk2dSpriteCollectionBuilder
« on: December 18, 2017, 03:45:01 pm »
For the life of me I can't seem to call tk2dSpriteCollectionBuilder.Rebuild, nor figure out why it doesn't come up.

Is there something that's changed? As there are previous references to you stating to call Rebuild after changing tk2dspritecollection item names. I'm doing this to not have to type in everything manually, generating category and names from the source filename.

Using Unity 5.6.1.

Thanks!

schmoey

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Rebuild collection item names with tk2dSpriteCollectionBuilder
« Reply #1 on: December 18, 2017, 05:32:34 pm »
Obviously as soon as I post this I figure that bit out... it needs to be in the special editor folder. Dumb unity quirks.

OK so I mark the spritecollection as dirty, set the collection to rebuild, then save the assetdatabase, still nothing. The names have not been updated.

Any idea?

schmoey

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Rebuild collection item names with tk2dSpriteCollectionBuilder
« Reply #2 on: December 18, 2017, 05:54:03 pm »
Ref http://2dtoolkit.com/forum/index.php/topic,4706.msg21878.html#msg21878

You say "You should rename the sprites in the SpriteCollection... you can't just change the data object..."

Help!

schmoey

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Rebuild collection item names with tk2dSpriteCollectionBuilder
« Reply #3 on: December 18, 2017, 07:43:12 pm »
This has all been very cathartic for me.

SOLVED by changing the (tk2dspritecollection).textureParams.name parameter!

<3

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Rebuild collection item names with tk2dSpriteCollectionBuilder
« Reply #4 on: December 19, 2017, 05:38:49 pm »
Hi,

Glad you figured it out! For benefit of anyone else that looks at this in the future -
tk2dSpriteCollection.textureParams.name is the name of the sprite
EditorUtility.SetDirty(spriteCollection)
tk2dSpriteCollectionBuilder.Rebuild(spriteCollection)

will then upodate everything correctly. The script that picks this up needs to be in the editor folder to see the editor functions.