Beispiel #1
0
            /// <summary>
            /// Load dumped textures and put them in PersistentAssetCache so the GLTFSceneImporter
            /// can pick them up.
            /// </summary>
            /// <param name="gltfPath">GLTF path of the gltf that will pick up the references</param>
            /// <param name="texturePath">Texture path of the texture to be injected</param>
            internal void RetrieveAndInjectTexture(AssetPath gltfPath, AssetPath texturePath)
            {
                string finalPath = texturePath.finalPath;

                if (!env.file.Exists(finalPath))
                {
                    return;
                }

                Texture2D t2d = env.assetDatabase.LoadAssetAtPath <Texture2D>(finalPath);

                if (t2d == null)
                {
                    return;
                }

                string relativePath = ABConverter.PathUtils.GetRelativePathTo(gltfPath.file, texturePath.file);

                //NOTE(Brian): This cache will be used by the GLTF importer when seeking textures. This way the importer will
                //             consume the asset bundle dependencies instead of trying to create new textures.
                PersistentAssetCache.AddImage(relativePath, gltfPath.finalPath, t2d);
            }