Hello Guest

Author Topic: Creating Sprite Collections and Animations on Runtime  (Read 5093 times)

Ceraph

  • Newbie
  • *
  • Posts: 8
    • View Profile
Creating Sprite Collections and Animations on Runtime
« on: November 20, 2013, 04:37:40 pm »
Hello, I'm currently working on a dev tool for our project that our artists can use to create new entities in our game world. All of the entities of our game exist as entries in a database and the assets for these entities are stored on our server. As such I need to download the sprites from the server and generate my sprite collections and animations on runtime. I've found useful information on how to generate sprite collections in code here and here but these seem to be for rolling custom Sprite Collection generation in the editor. The largest problem I'm running into is the fact that tk2dSpriteCollectionBuilder is in the Editor folder and thus not included on runtime by Unity. Is there any way to generate a Sprite Collection on runtime? Alternatively, is there some way of including Editor scripts on runtime that I'm missing?

Thank you in advance.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Creating Sprite Collections and Animations on Runtime
« Reply #1 on: November 20, 2013, 06:51:40 pm »
You will have to include a fair bit to generate a sprite collection atlas at runtime. While its possible, I wouldn't recommend it. All of the tk2d runtime is pretty lean, whereas the editor code allocates a ton of memory. Wouldn't it be possible to generate the atlas it self on the server?

Failing all that you could probably try Texture2D.PackTextures to pack the textures, and then use the runtime sprite collection stuff to set it up. It won't pack anywhere near as efficiently as tk2d though.

Ceraph

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Creating Sprite Collections and Animations on Runtime
« Reply #2 on: November 21, 2013, 12:05:39 am »
Thank you for the suggestions, I will look into those possibilities.

hougenit

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Creating Sprite Collections and Animations on Runtime
« Reply #3 on: December 04, 2013, 10:27:42 am »
Have you solved the problem?I also need to do like this.