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

No easy way to disable AutoScene for PlayMode tests #4

Open
WraithDrof opened this issue Mar 16, 2023 · 6 comments
Open

No easy way to disable AutoScene for PlayMode tests #4

WraithDrof opened this issue Mar 16, 2023 · 6 comments

Comments

@WraithDrof
Copy link

I've been trying to find a graceful way to do this and thought I'd reach out before devoting any more to it. Right now if AutoScene is enabled, it breaks my playmode tests which care about which scene I'm in (even though they seem to be loading the same scenes).

What I really want is for AutoScene to disable itself if it detects the app running in a test. Something like this seems ideal:

  • A test starts running and creates a test scene
  • AutoScene detects that we are in a test fixture and it disables itself
  • The test runs
  • Afterwards, AutoScene resets to its previous value (which for me, would always be enabled).

Of course it would also be good if AutoScene just didn't auto-initialise that scene, but my limited understanding of how this works means I'm guessing that's not possible.

@chsxf
Copy link
Owner

chsxf commented Mar 17, 2023

Thanks for reaching out.
I'll have to take a closer look at the Test Runner and see if I can interface with it in order to detect when a run is launched.
I am also currently investigating Play Mode tests so I would probably end up with the same issues. So I would have probably written a fix soon anyway.

@WraithDrof
Copy link
Author

WraithDrof commented Mar 19, 2023 via email

@chsxf
Copy link
Owner

chsxf commented Mar 24, 2023

I've investigated this issue today and I'm hitting a road block.
The Test Framework provides callbacks for when tests start and finish. Unfortunately, the "start" callback is sent after the editor has transitioned to Play Mode, making impossible to disable AutoScene beforehand.
I will continue to dig into the code of the Test Framework but that's a L for now.

@WraithDrof
Copy link
Author

WraithDrof commented Mar 25, 2023 via email

@chsxf
Copy link
Owner

chsxf commented Apr 1, 2024

Just to let you know, with version 1.3.0, I've added ways to disable/enable AutoScene programmatically. There are also getters to let you know if AutoScene is enabled or not. With one-time set ups / tear downs in tests, you should be able to disable/enable AutoScene before and after all your tests.

@WraithDrof
Copy link
Author

WraithDrof commented Apr 14, 2024 via email

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

2 participants