How to change texture type to Cubemap in script?

My app will download stereoscopic images(.jpg) from server, and convert them into cubemap, applied to material and used as skybox.

How do I achieve in script?

AssetImporter can only be reached from UnityEditor.

You’ll need to find a way to read in the JPG into a Color and then use SetPixels() on a new cubemap.

A cubemap is simply a collection of 6 textures. To create a cubemap at runtime you simply use the Cubemap-class like FortisVenaliter mentioned.

The “import type” you’re referring to is an editor-only feature. At runtime none of the asset importers are available. So all those “settings” you see in the inspector belong to the AssetImporter and don’t exist at all at runtime.

If you import an image in the editor, Unity actually splits / extracts those 6 images from the incomming texture data. Take a look at this.

Hi, I am having the same problem. How did you resolve this? @felixwcf