batching images loaded dynamically.

I'm having an issue trying to find a solution to this.

I need to assign sprites to sprite renderers dynamically via only code. (I have list of folders that contain images and a mapping file documenting what image is in the folder loaded).

So I have the folders under resources, and I am using resources.load to load the images into sprite renderers. When I do this though, I cannot use sprite packing and each sprite is coming in a separate draw call.

How can load images dynamically via code while batching (preferably static) draw calls?

You'll have to use a sprite sheet texture instead of separate image files.

Is there any way to take advantage of Unity’s auto sprite sheet creation?
Making sprite sheets is time consuming as I have 4,000 images, and I have hundreds of mapping files that use the image name to control how the scenes are created all dynamically.

I think the sprite sheet building is an ‘editor’ functionality, not a runtime one.

I understand it only being a design time thing.
I just can’t figure out a way to get batched draw calls when using resource folder for sprites unless I package them outside of Unity using a third party tool (like Texture Packer).

this addon combines meshes, and atlases their textures:

maybe you could look at the source code and see how the texture atlasing is done, and then use that method to generate your own atlases at runtime from the dynamically loaded images

An atlas/sprite sheet (either via Unity or externally) is only way to get the draw calls to batch right?