Hi!
Long story short:
I want users to be able to import their own 360 images (pngs) at runtime (I think I got that part down), but then create a skybox with that image and apply it to the scene.
I know I can create new materials at runtime, but how would I take a png, set it to “cube” and apply that to a new material with the skybox/cubemap shader at runtime?
Thanks!
var bytes=tex.EncodeToPNG();
string path="Assets/Resources/... .png";
File.WriteAllBytes(path,bytes);
AssetDatabase.Refresh();
AssetDatabase.ImportAsset(path);
TextureImporter importer = AssetImporter.GetAtPath(path)as TextureImporter;
importer.textureType=TextureImporterType.GUI;
AssetDatabase.WriteImportSettingsIfDirty(path);
Add comment ·
Change type.gui to wath you want
I appreciate the reply… but 'm not quite sure I understand exactly what’s happening in the code you wrote.
I need this to work at runtime standalone, and I’m pretty sure the AssetDatabase class is only usable in editor.