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

Entity SubScene Support #46

Open
Selmar opened this issue Apr 28, 2023 · 8 comments
Open

Entity SubScene Support #46

Selmar opened this issue Apr 28, 2023 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@Selmar
Copy link

Selmar commented Apr 28, 2023

Entity scenes work differently from regular scenes.

Opening this issue even though entities is still in preview (though not for long if I heard right). I don't know if they will be modifying this, so perhaps it is too early, but I'll describe the current state.

  • If you load a scene from the build settings, which contains a SubScene, everything works as expected. The SubScene does not need to be in the list directly (in fact, I suspect it is best to make sure it isn't).
  • If you load a SubScene programmatically (using the guid given by this repository's SceneReference for example), the SubScene must be referenced by a scene (can be any) in the build settings, or it will not be able to be loaded.

Personally I've created a scene that contains all my SubScenes and I've added it to the build settings scene list. This works fine.

image
image

@starikcetin
Copy link
Owner

starikcetin commented Apr 28, 2023

This sound like a problem with Entities and not this package. The only thing I can think of would be to display a warning message in this case, and that would be costly in terms of editor performance to implement, so I am not sure.

Also, I am a bit confused by your setup regarding the SubScenes, as they are not intended to be loaded like regular scenes, but rather they should already exist in another scene via the SubScene component.

@Selmar
Copy link
Author

Selmar commented Apr 29, 2023

The entities package has its own scene loading functionality for SubScenes, SceneSystem.LoadSceneAsync. Determinism is important for us, so we load the subscenes one by one using this method.

To be fair, I haven't tried to use that function with a regular scene, but regular scene loading comes with a significant performance overhead, so I decided to load the subscenes directly.

I completely understand your remark about editor performance, and I do not have a good solution in mind either right now. If I recall correctly, in entities 0.5 there were build configurations which could reference entity scenes to be included, but they stopped using those.

@starikcetin
Copy link
Owner

I see, I haven't been keeping track of the Entities API lately. I will implement a scan feature then, but make it toggleable.

@starikcetin starikcetin self-assigned this Apr 29, 2023
@starikcetin starikcetin added the enhancement New feature or request label Apr 29, 2023
@starikcetin
Copy link
Owner

On a second look at the current API, I decided to wait until things stabilize, as there seems no way of implementing a scan feature easily at the moment other than a full instructions scan via reflection.

When the entities package is out of preview and it is officially supported, feel free to ping me about this issue again and I will reevaluate the options.

@starikcetin starikcetin closed this as not planned Won't fix, can't repro, duplicate, stale Apr 29, 2023
@Selmar
Copy link
Author

Selmar commented Jun 26, 2023

The entities package is at 1.0.11 now and goes with the 2022.3 LTS.

To summarize, a scene is added into the build if it's either:

  • in a SubScene monobehaviour in a scene that's added into the build, or
  • somehow baked in a subscene via strong or weak reference as described here

In our project we currently added a pre-build step where we add all subscenes from a scriptable object to a generated scene.

@starikcetin starikcetin reopened this Jun 26, 2023
@starikcetin
Copy link
Owner

@Selmar Thank you for notifying me. I am currently working on Addressable Scene Support in #47. After it is done, I will look into this again.

@starikcetin starikcetin changed the title [[email protected]] Entity SubScenes are not properly dealt with Entity SubScene Support Jun 26, 2023
@starikcetin starikcetin pinned this issue Jul 3, 2023
@Selmar
Copy link
Author

Selmar commented Jul 10, 2023

I saw your message, seems you deleted it?

It seems to me that the only missing piece you need is the elimination of false negatives (scene not in build inline warnings) for SubScenes that are referenced by a scene in build, but not added to build directly.

I think this is almost correct, but I see a problem: I don't know how we can identify a scene as a SubScene or a regular Scene. Maybe we need a different wrapper type (i.e. Eflatun.SubSceneReference)?

@starikcetin
Copy link
Owner

I saw your message, seems you deleted it?

It seems to me that the only missing piece you need is the elimination of false negatives (scene not in build inline warnings) for SubScenes that are referenced by a scene in build, but not added to build directly.

I think this is almost correct, but I see a problem: I don't know how we can identify a scene as a SubScene or a regular Scene. Maybe we need a different wrapper type (i.e. Eflatun.SubSceneReference)?

Yes, I realized there are some other parts that need to be addressed as well, one of them being what you mentioned, so I deleted the message.

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

Successfully merging a pull request may close this issue.

2 participants