-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Don't auto create assets folder #11218
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we document that FileAssetReader::new
does not create a directory?
I don't feel particularly strongly, but we should fix the typo pointed out above.
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
I feel it's probably unnecessary since I personally wouldn't expect a file reader to do create anything. It is much more surprising as it is right now IMO–creating a directory undocumented. |
@thepackett, could you review this little PR? Does this make sense with your understanding of the asset lifecycle? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I can't say I support this change for a couple reasons.
I think creating the asset directory is the appropriate default behavior, since if it didn't create the asset directory automatically then you would manually have to create the folder and work your way through any possible errors or misunderstandings along the way.
Secondly, this behavior can be disabled. When the AssetPlugin starts it checks to see if any AssetSourceBuilder
s are in the AssetSourceBuilders
resource, and if there aren't any then it uses the default AssetSources, which includes the file source. Thus you can disable this by providing your own AssetSourceBuilder
s before adding the Asset Plugin as per this example.
As for the documentation and panic error message, this is good and I will always approve of better error messages and documentation.
I see what you're saying, and I might even agree if In my opinion, automatically creating an assets folder without context isn't very helpful either. It wouldn't be obvious to a new user why the folder exists or how to import assets just from it existing. They would still have to discover And just to clarify since I think it might be unclear: this doesn't cause a panic with just the default features and no assets folder. Bevy runs just fine without an assets folder. The updated panic message only happens if the user enables the I would definitely agree, though, that better documentation would be useful. I just feel it wouldn't be very helpful here as beginners would probably not look at the internals. There should probably be a section on asset loading in The Bevy Book. I could add a comment here though, if required, just feels a little superfluous to say that a file reader does not create a directory. |
I'm a vote for the panic behaviour as is. A potential follow-up could be having bevy_assets use a build.rs and allowing to opt out. Further out in the future a cargo bevy-project generator perhaps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if bevy did not silently create file directories, so I'm in favor of merging this.
I know I'm somewhat repeating myself here, but I don't believe that the defaults for plugins are unreasonable. Bevy is built to be as modular and as flexible as possible so that you can really dig into the engine and modify and configure it however you want. However, that flexibility comes at the price of complexity for the developer. The purpose of the default behavior is to provide a decent starting point for the majority of users so they can get up and running as quickly as possible without having to spend hours configuring every plugin they use in every project they create. I think that the AssetPlugin using the File AssetSource by default is reasonable, and creating the directory that all assets must be placed in for the File AssetSource to work by default is also reasonable. |
Co-authored-by: Nicola Papale <nicopap@users.noreply.github.com>
While I acknowledge the reasoning behind creating an empty assets folder being the default, I'd contend that it extends beyond what one might reasonably expect, especially when Bevy is installed as a dependency via Cargo (since it does not own the project and thus shouldn't make changes imo). Such behavior might be more fitting for a standalone Bevy editor (i.e. like Unreal/Unity), where ownership is clear. I think my previous comment made my perspective clear beyond that. It ultimately boils down to weighing the cost of silently creating the assets folder against the convenience of it always being there by default. |
Agreed. We've both made our case and it really comes down to the core vision for bevy, which is probably why this has been tagged as controversial. This means that Cart (or two SMEs, which I don't believe we have for Bevy Asset) needs to take a look at this to decide. |
Yep. I interpreted the behavior as a bug since it didn't happen in 0.11 or previous and the change wasn't documented. Hadn't intended to comment on Bevy's philosophy, but I guess that's where this wound up! In case it's decided that this should be the new default, I'd like to see a warning because it's still unexpected. It would be great if @cart could comment, especially since the behavior was added in 5eb292d. |
I would be for not creating the asset folder. This should be created by the project template / editor, or by the user explicitly |
Agreed! |
# Objective - Since #11218, example `asset_processing` fails: ``` thread 'main' panicked at crates/bevy_asset/src/io/source.rs:489:18: Failed to create file watcher: Error { kind: PathNotFound, paths: ["examples/asset/processing/imported_assets/Default"] } ``` start from a fresh git clone or delete the folder before running to reproduce, it is in gitignore and should not be present on a fresh run https://github.com/bevyengine/bevy/blob/a6574786757c0a0a7ddffb99fdc40ce90980fc82/.gitignore#L18 ## Solution - Auto create the `imported_assets` folder if it is configured --------- Co-authored-by: Kyle <37520732+nvdaz@users.noreply.github.com>
Objective
Solution