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

Assets not findable by Content.FileProvider.ListFiles(...) #2020

Open
MEEMexe opened this issue Nov 1, 2023 · 3 comments
Open

Assets not findable by Content.FileProvider.ListFiles(...) #2020

MEEMexe opened this issue Nov 1, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@MEEMexe
Copy link

MEEMexe commented Nov 1, 2023

Release Type: Official Release

Version: 4.1.0.1948

Platform(s): Windows

Describe the bug
Prefabs which are placed in a scene (so they are "Included in build as Dependency") are not in the array that gets returned by DataBaseFileProvider.ListFiles("Directory", "*", VirtualSearchOption.AllDirectories).

To Reproduce
Steps to reproduce the behavior:

  1. Create Prefab
  2. Place Prefab in a scene (now the green dot is shown on the prefab)
  3. Call DataBaseFileProvider.ListFiles("Directory", "*", VirtualSearchOption.AllDirectories). with the directory where the prefab got saved
  4. Inspect the array returned by the method

Expected behavior
The name of that prefab should be in that array.

Screenshot 2023-11-01 015157

Code for reproducing this bug.
public override void Start() { var e = Content.FileProvider.ListFiles("", "*", Stride.Core.IO.VirtualSearchOption.TopDirectoryOnly); foreach (var element in e) { Log.Info(element); } }

No file named "TestEntity1".
Screenshot 2023-11-01 015457

@MEEMexe MEEMexe added the bug Something isn't working label Nov 1, 2023
@MEEMexe
Copy link
Author

MEEMexe commented Nov 1, 2023

It's worth pointing out that as soon as you reference the Prefab in a scriptcomponent with a public prefab field:
public Prefab prefab;
image
It's working again.

@MEEMexe
Copy link
Author

MEEMexe commented Nov 1, 2023

Also just changing the Prefab to "Included in build as root asset" instead of dependency fixes the problem.

@manio143
Copy link
Member

manio143 commented Nov 1, 2023

The reason this isn't working as you expect is that placing a prefab in a scene is only referencing that prefab at compilation time. The entities are copied over to the scene and can also have modified properties from the original prefab. So this works without instantiating the prefab at runtime when the scene is initialized.

What is misleading here is the reference dot being turned on. On one hand it's correct - scene references the prefab as it is needed for compilation. On the other hand user expects to see referenced assets (green or blue dot) to be available at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants