Skip to content

Commit

Permalink
make sure _gltfFileName is set in an import context in the editor whe…
Browse files Browse the repository at this point in the history
…n loading from a stream
  • Loading branch information
hybridherbst committed Aug 26, 2023
1 parent 43c814c commit 2b43c72
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions UnityGLTF/Assets/UnityGLTF/Runtime/Scripts/GLTFSceneImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,17 @@ public async Task LoadSceneAsync(int sceneIndex = -1, bool showSceneObj = true,
Statistics = new ImportStatistics();
progress?.Report(progressStatus);

#if UNITY_EDITOR
// When loading from a buffer, this is not set; sanitizing that here
// so we can log proper file names later on
if (_gltfFileName == null)
{
var importSource = _options?.ImportContext?.AssetContext?.assetPath;
if (importSource != null)
_gltfFileName = importSource;
}
#endif

if (_gltfRoot == null)
{
foreach (var plugin in Context.Plugins)
Expand Down

0 comments on commit 2b43c72

Please sign in to comment.