Loading spriteframe asset from properties leads to error when reloading scene

hi,
I am getting an error in the following scenario :
I have a typescript with an attribute of type cc.SpriteFrame which I then assign to the sprite frame property of a sprite component of a node.
In onDestroy of the typescript, I release the sprite frame asset.
I reload the same scene that I am currently in.

the scene doesn’t load for the second time(it loads just fine the first time). the second time I get the following error :
cannot read property ‘_format’ of null

when I dynamically load the sprite frame using loadres , I don’t get the error.

can someone tell me why this is happening?

Thanks!

when do you assign the spriteframe to your node? is it in the scene file in the editor?

hi,
I have a script with a member variable of type sprite frame which I then assign to a node in the script as follows :

someNode.getComponent(cc.Sprite).spriteFrame = variable;

Cheers!

ok it sounds like the spriteFrame is already set in your member variable when the scene first loads because you dragged a spriteFrame into the member in the gui right?

then when you destroy it and reload the scene, the spriteFrame is no longer set in your member variable because it was set to null (as opposed to the first time around the member is set to the entity you dragged into the spot)