Home > database >  Delete Image from game in script
Delete Image from game in script

Time:10-27

1. Summarize the problem

The following second code should delete the line that gets cloned in the first script. The command Destroy() doesn't delete it.

2. Describe what you've tried

I've tried searching around for similar cases but i can't find what i need. No Error message appear

3. Show some code

Code that creates the Image

Image CloneLine = Instantiate(Line);

Code that should but doesn't delete the Image

Destroy(Linee[i]); //The name is different from the CloneLine cause it gets deleted from another script.

CodePudding user response:

The Destroy(Linee[i]); command is missing one part. By writing it like that it would only delete the image. To delete the gameobject it should be written: Destroy(Linee[i].gameobject);

I found out about this later

  • Related