No easy way to disable AutoScene for PlayMode tests
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.
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.
Ok great, thank you!
On Fri, 17 Mar 2023, 11:21 pm Christophe SAUVEUR, @.***> wrote:
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.
— Reply to this email directly, view it on GitHub https://github.com/chsxf/AutoScene/issues/4#issuecomment-1473835646, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACENCF5DEVT4J4NRY74QADDW4RQNXANCNFSM6AAAAAAV42NHHQ . You are receiving this because you authored the thread.Message ID: @.***>
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.
Hmm, would it be possible to have a menu item editor script that enters normal play mode? That way you could keep it disabled but when you need to test the game in editor you can use that dropdown instead of the play button.
It sounds a little easier than managing the toggles, especially if you could bind it to a key.
On Sat, 25 Mar 2023 at 08:07, Christophe SAUVEUR @.***> wrote:
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.
— Reply to this email directly, view it on GitHub https://github.com/chsxf/AutoScene/issues/4#issuecomment-1483485528, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACENCF5NUAJ26L3JAMKQ62LW5YLL3ANCNFSM6AAAAAAV42NHHQ . You are receiving this because you authored the thread.Message ID: @.***>
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.
Thank you!!
On Mon, 1 Apr 2024 at 20:28, Christophe SAUVEUR @.***> wrote:
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.
— Reply to this email directly, view it on GitHub https://github.com/chsxf/AutoScene/issues/4#issuecomment-2029545206, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACENCF22XAJCUP2ADIYCVJDY3EZDVAVCNFSM6AAAAAAV42NHHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRZGU2DKMRQGY . You are receiving this because you authored the thread.Message ID: @.***>