Hello Guest

Author Topic: Sprite Collection disappearing upon game start  (Read 3207 times)

DemiGoth

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Sprite Collection disappearing upon game start
« 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?

DemiGoth

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Sprite Collection disappearing upon game start
« Reply #1 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...