Good day to all.
At the moment I am creating the 2d game with quite a lot of art. It is
more than 1k sprites there. It should be possible to load any combination
of pictures at runtime. I’d already implemented all the logic, but have a
trouble that is annoying me.
In the current version all the sprites are inside Resources folder and are loaded
using
Sprite sp = Resources.Load("name", typeof(Sprite)) as Sprite;
It works fine.
There are almost no POT-size images, so without packing to atlases there
is a huge memory overhead. iOS build takes about 500 Mb on device. That’s
why I want to pack my sprites to atlases. But there is a couple of troubles with
it.
First of all, after enabling, unity’s Sprite packer do not wanna pack my images
to atlases (I specified tags for my sprites). There is nothing happens after
clicking “Pack”/“Repack”. I thought that it is because location of my sprites
(Resources folder), but even after moving them to different folder, Sprite packer
works strange. Anyway, at the moment I created test project, copied all the
pictures there and packed them (still cannot pack them in the original project).
The next trouble, that I cannot find how to load sprites from created atlases
at runtime without assigning them to variables in my scripts.
I cannot find enough info in the official reference and on the forums, as this is
quite a new feature, but hope that someone here can give me needed answers.
Have a nice day and thanks for reading =)