2D Toolkit Forum

2D Toolkit => Support => Topic started by: Noego on June 26, 2013, 04:37:58 pm

Title: Creating a prefab from a tk2DSprite
Post by: Noego 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.
Title: Re: Creating a prefab from a tk2DSprite
Post by: unikronsoftware 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?
Title: Re: Creating a prefab from a tk2DSprite
Post by: Noego 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.
Title: Re: Creating a prefab from a tk2DSprite
Post by: unikronsoftware 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?
Title: Re: Creating a prefab from a tk2DSprite
Post by: Noego 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.