Hello Guest

Author Topic: Creating a prefab from a tk2DSprite  (Read 5154 times)

Noego

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Creating a prefab from a tk2DSprite
« on: June 26, 2013, 04:37:58 pm »
Hello,

Here is my problem :
If I create a prefab from a sprite in the scene, the MeshFilter disappears in the prefab.
I suppose that it is due to the fact that the mesh for the sprite was dynamically generated.
So I wonder if there is a clean way to create a prefab with 2D Toolkit?

Thanks,
Noego.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Creating a prefab from a tk2DSprite
« Reply #1 on: June 26, 2013, 05:00:37 pm »
The prefab won't have the mesh set as it needs lot be dynamic. Is there any reason you need the mesh on the prefab?

Noego

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Creating a prefab from a tk2DSprite
« Reply #2 on: July 01, 2013, 08:54:23 am »
If I instantiate the prefab in the scene, the sprite doesn't display because it has no mesh. So I have to commit the collection each time I instantiate a prefab in a scene in order to recompute the mesh.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Creating a prefab from a tk2DSprite
« Reply #3 on: July 01, 2013, 09:35:17 am »
That doesn't sound right - the mesh is created on Awake, so it should create it as soon as its instantiated, unless some data on the prefab is invalid. Can you send me a repro sample to support at unikronsoftware.com?

Also what version (tk2d & unity) are you running?

Noego

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Creating a prefab from a tk2DSprite
« Reply #4 on: July 01, 2013, 03:06:18 pm »
I just found that one of our script on the prefab was disabling the sprite Awake.
Now it works perfectly!

Thank you.