Question

In unity3d i declared

var ribbon : GameObject;

In start function i have used code

Destroy (ribbon.gameObject, 5); 

which shows error "Destroying assets is not permitted to avoid data loss. If you really want to remove an asset use DestroyImmediate (theObject, true);"

how can i destroy this gameobject?

Thanks in advance

Was it helpful?

Solution

Try this

Destroy(gameObject.Find("ribbon"), 5);

OTHER TIPS

You could Just do Destroy(ribbon,5); if you have assigned the ribbon gameobject already ribbon is already a gameobject no need to do ribbon.gameObject

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top