I am working with a large system using many assetbundles to build a scene dynamically. Currently I am attempting to build texture atlases after the assetbundles are loaded. Each asset bundle is one or more mesh with the required materials referencing textures.
The issue I am running into is the textures loaded from the assetbundles are not readable therefore Texture2D PackTextures fails. I understand without the Readable flag the data of the texture is not accessible therefore GetPixels won't work. I am also aware having this flag on will cost more in memory, it is a cost I am willing to bear.
One suggested solution is change the importer settings through UnityEditor.AssetPostProcessor. The problem is this works in the editor but not at runtime. When I build the assetbundles the textures are set to "Advanced" and Read/Write Enabled is checked. When I load the assetbundles the textures are not set to readable. I understand this setting is applied to the importer not the texture itself.
- Is there a way to access the importer for the assetbundle or texture within at runtime?
- UnityEditor.dll is not accessible outside the editor (at runtime) so how are you to handle importer logic or set specific Textures to be Readable outside the editor?
I am in Unity 5.2 now but would be open to move to Unity 5.3 if there is a viable solution to this issue.
Thank you,
Matt
↧