If you create a prefab of the sprite, drag that prefab into the script in the editor, you can instantiate and delete it whenever you want. But what you probably should look into is Addressable Assets.
Well you nulled out your reference to it, so how do you expect to find it again? You have to load it dynamically in some fashion, which cone be done through either Resources or Addressables.
This isn’t accurate. Assets in resources just go into their own special asset bundle at build, accessible through the Resources API. They’re a part of a build like any other asset, just one you have some degree of granular access to.
Streaming assets is the folder you want if you need files to be kept outside of a build, but it comes with the major downside that you’re now responsible for loading those files in at runtime. Which might not sound like a problem but it is thanks to the fact that most of the code that would handle it in the editor isn’t available at runtime.
There are other headaches involved too like having very specific access requirements on some platforms that are very difficult to find information on thanks to how often the platforms change.
Any asset stored in a Resources folder will be included/packed in the build.
When you do Resources.Load(“filename”) Unity will simply load the file into memory and return a reference to it.
The resources folder exists as a way of including assets in a build without having to make a reference to them from within a scene. Sometimes developers only want to load assets when necessary as it can be a great way of reducing loading times.
Keep in mind that loading assets while a game is running can cause stutter, especially if you’re loading a large texture or mesh into the GPU. So this is why Unity is biased towards loading meshes and textures at the start of a scene and stuffing them into the GPU.
I’ve already implemented this and yet I’m still seeing a massive spike on the CPU from Loading.ReadObject which is trying to read the sprite into memory even though this should’ve already read the sprite into memory so it’s not working at all