Why will the following code give me a null ref exception:
private tk2dSpriteCollection sCollection;
// Use this for initialization
void Start ()
{
sCollection.spriteCollection = GetComponent<tk2dSprite>().Collection;
}
And the following code doesn't give me an exception, I'm not assigning anything to the public object, the only thing I'm doing is changing the access modifiers from private to public...
public tk2dSpriteCollection sCollection;
// Use this for initialization
void Start ()
{
sCollection.spriteCollection = GetComponent<tk2dSprite>().Collection;
}