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 Callbacks for Completion and Progress in useLoader.preload #3320

Open
sintanial opened this issue Aug 2, 2024 · 0 comments
Open

Add Callbacks for Completion and Progress in useLoader.preload #3320

sintanial opened this issue Aug 2, 2024 · 0 comments

Comments

@sintanial
Copy link

First of all, I want to say that your library is fantastic and has saved me a lot of time and effort!

I encountered an issue where useLoader.preload does not support callbacks for completion and progress. This seems logical and feasible, considering that internally, THREE.Loader.load is used, which accepts callbacks for both completion and progress. While I am aware of useProgress, it doesn't suit my needs because I want to determine when a specific asset has successfully loaded, rather than all assets together.

I want to load all my assets as soon as the page opens and show a loading indicator during this time. useProgress can jump between states, making it unclear when the loading of all my assets is truly complete.

Here is an example of how I currently load my assets:

useGLTF.preload(assets.map(asset => asset.path));
useLoader.preload(THREE.AudioLoader, '/effects/firecracker.mp3');
useLoader.preload(QuarksLoader, '/effects/levelup.json');
useLoader.preload(QuarksLoader, '/effects/fireball.json');

Additional Information:

Adding callbacks to useLoader.preload would greatly enhance its functionality, allowing for more granular control over asset loading and improving the user experience by providing precise loading indicators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant