I want to load a zip file with some basic content for the user. But when I use this:
TextAsset zipAsText = Resources.Load(path, typeof(TextAsset)) as TextAsset;
object zipObject = Resources.Load(path);
Both returns ‘null’. As path and path.zip.
Is it possible to load a zip from resources?
EDIT: Just to be clear, it is a .zip file. It contains .xml and .jpg within the .zip.
Unity will include your file in Resources as a text asset if it’s got a file extension documented as supported. Maybe look at the size of the resources.asset file in the build. Add in some text assets that are around 1M in size and see if the resources.asset grows in size accordingly.
I assume you want to have a zip file with some content which is unpacked at runtime.
Two possible solutions:
put the zip file in the streaming assets folder. (normally used for playing videos). Then do your unzip magic at runtime
another solution is to rename your zip file (zip is not a supported extensension for the resources.load folder) to, for example .bytes
TextAsset textAsset = Resources.Load(assetName, typeof(TextAsset)) as TextAsset;
where assetName = location of your .bytes file (without the extension)
where fullZipPathname = persistantdatapath/nameofthefile.zip
then, do your unzip magic.