2D Toolkit Forum

2D Toolkit => Support => Topic started by: DemiGoth on November 20, 2013, 07:13:40 am

Title: Sprite Collection disappearing upon game start
Post by: DemiGoth on November 20, 2013, 07:13:40 am
I've made a couple of sprites to use as overlay (game pause & game over to start with) and have declared it like this in my code:

Code: [Select]
public class MainGame : MonoBehaviour
{
public tk2dSprite myGameOverlay;

void Start ()
{
myGameOverlay = GetComponent<tk2dSprite>();
}

I have also dragged & dropped the Overlay sprite collection into my code and it's there just fine. But the moment I run my game it disappears and the field for sprite collection is empty again, only to reappear the moment I end my game. I can drag & drop it there while playing and it works normally.

Any idea how this comes and how to get it working as it should?
Title: Re: Sprite Collection disappearing upon game start
Post by: DemiGoth on November 20, 2013, 08:01:20 am
Found a work-around... I  attached a script to the object I'm calling and instead of managing the object I'm calling the script in it to show/hide the overlays...