1
\$\begingroup\$

Basically, unity imports new images (png, jpg) as default textures but I need to import them as sprites instead.

As there are lots of sprite sheet new assets in my game, it's time consuming to change the import setting for many assets.

I know I can make an AssetImporter and use it but it doesn't work and I don't know how to use it for sprites.

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

Under Edit > Project Settings, select the Editor section and change Default Behaviour Mode to 2D:

Screenshot of Project Settings

This does two things:

  • Any newly-added images will be imported as sprites by default

  • When you create a new scene, it will be created with the 2D preset (orthographic camera, no light, scene view 2D toggle on) instead of the 3D preset (perspective camera, directional light, scene view 2D toggle off)

This second effect isn't one you want, but it doesn't do anything irrevocable - you can turn off the 2D toggle, add a light, and change the camera mode after the fact. Or you can switch to 3D mode when you're creating a bunch of scenes, and switch back to 2D mode when importing a bunch of images. Or you can take an existing template scene and save it under a new name, then work from that - no defaults to fight against.

You'll likely have more images to import than scenes to create, so this should still give you a net savings in time and labour, even if you have a little extra fussing to do when making scenes.

\$\endgroup\$
5
  • \$\begingroup\$ than you for the answer. it works but could I still use assetimporter for this situation to have complete control over importing the assets(image, etc)? this is something not very used and well documented for unity. \$\endgroup\$
    – virtouso
    Commented Aug 13, 2021 at 12:17
  • 1
    \$\begingroup\$ That's a different question than the one you asked. You asked 'How to import images as sprites". If you want to ask "How to make an AssetImporter that does [xyz]" then you are welcome to post that as a new question. \$\endgroup\$
    – DMGregory
    Commented Aug 13, 2021 at 12:19
  • \$\begingroup\$ ok. I will ask it because I like to know how it works. basically, I tested it but the OnImportAsset was not getting called at all. \$\endgroup\$
    – virtouso
    Commented Aug 13, 2021 at 12:24
  • 1
    \$\begingroup\$ That's more detail that's absent from your question. Remember to actually write these things if you want users to know what you need help with. You've been here long enough to know that "it doesn't work" is never enough information to use for successful troubleshooting. \$\endgroup\$
    – DMGregory
    Commented Aug 13, 2021 at 12:26
  • \$\begingroup\$ This man not only gave an answer, he gave a whole workflow! Hat's off to you, @DMGregory, sir! Very good answer! o7 \$\endgroup\$ Commented Aug 13, 2021 at 15:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .