Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to hide scene obj during loading in GLTFComponent #690

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions Runtime/Scripts/GLTFComponent.cs
Expand Up @@ -22,6 +22,8 @@ public class GLTFComponent : MonoBehaviour
public bool UseStream = false;
public bool AppendStreamingAssets = true;
public bool PlayAnimationOnLoad = true;
[Tooltip("Hide the scene object during load, then activate it when complete")]
public bool HideSceneObjDuringLoad = false;
public ImporterFactory Factory = null;
public UnityAction onLoadComplete;

Expand Down Expand Up @@ -114,6 +116,7 @@ public async Task Load()

// for logging progress
await sceneImporter.LoadSceneAsync(
showSceneObj:!HideSceneObjDuringLoad,
onLoadComplete:LoadCompleteAction
// ,progress: new Progress<ImportProgress>(
// p =>
Expand All @@ -133,6 +136,9 @@ public async Task Load()
}

LastLoadedScene = sceneImporter.LastLoadedScene;

if (HideSceneObjDuringLoad)
LastLoadedScene.SetActive(true);

#if UNITY_ANIMATION
Animations = sceneImporter.LastLoadedScene.GetComponents<Animation>();
Expand Down