Hi there
I have created a procedural texture and now want to save it.
Do I use AssetDatabase.CreateAsset(texture, “Assets/texture.asset”)
I need to encode the texture to PNG first?
Any insight would be great.
Hi there
I have created a procedural texture and now want to save it.
Do I use AssetDatabase.CreateAsset(texture, “Assets/texture.asset”)
I need to encode the texture to PNG first?
Any insight would be great.
You don’t have to, but it will save space on your hard drive, and it’s not hard, so you might as well. The documentation has an example, and here is one I use.
Ok the scenario is this:
I have enabled the user create a texture. There is
a button to save this texture.
So when the user clicks the save button I want to be able to save the texture as an asset - then reload the texture and then analyse the data held in this texture.
So I would use
AssetDatabase.CreateAsset
Can this be used at run time?
Well, that would have been good to know. ![]()
No. I don’t know how it’s done. I’d especially be interested in knowing how it’s done on the iPhone where there is no hard drive browser.
Cant I save the data to an enternal file - XML - then reload it?
Assetxxx is editor only so no you can’t create it at runtime.
at runtime you need to use System.IO for storage and you would store it into the cache folder normally (documents is itunes backuped and should therefor only be used for truely persistent data like gamesaves etc)
as for xml: potentially but its a bad idea if you ask me as you want to store a, out of xmls view, massive sized pure binary blob, not structured data.