Closed GordeyChernyy closed 3 years ago
After entering play mode a second time I have the same errors and need to restart Unity to make it work again but only one time
@GordeyChernyy what sample scene are you seeing this on?
And how are you loading the samples? Through Unity Package Manager? OpenUPM?
I used Unity Package Manager and used MVVMTest sample through package download sample feature
Cool. Will try to re-pro. FYI I'm suggesting people use OpenUPM now since it supports versioning: https://openupm.com/packages/com.push-pop.unitymvvm/
I never tried to install the package using OpenUPM will try now. Thanks!
Personally am using Scoped Registry with Unity Package Manager: https://docs.unity3d.com/Manual/upm-scoped.html
The OpenUPM dev recommends using his commandline tool.
I will try to add instructions soon to the repo
I installed the package through OpenUPM but it has the same issue. It is running fine for the first time but then starts throwing exceptions on the second time you enter play mode
It might be Unity 2020 just checked in 2019 it works but let me check empty project in 2020
The package works in empty project 2020 but can't get it working in my project, I removed the Library folder but it didn't help
hmm just the samples don't work or your project too? Any more details about the issue?
If this is the line in question I'm not sure how there could be a null reference...
After restarting I have this singleton in the scene and everything works
Next time there is no singleton:
And after creating it manually I still have errors
It kinda seems like this would be an issue with the Singleton class then? Like it's not getting cleaned up between runs so it isn't getting created again. Maybe there was a Unity API change?
I need to download 2020 and will try it to see what's up. Can you repro on a new 2020 project? Otherwise are you able to share your project possibly?
What version of 2020 are you on?
here is the repo (2020.3.0f1) https://github.com/GordeyChernyy/MVVMTest It is a copy of the original project I removed all assets from the Assets folder and the issue is still present. Steps to reproduce:
Another note I realized that my new samples aren't in there! No wonder no-one can figure out how to use 😆
I see you have a Basic Usage folder I will try to import it directly from git
Yes It does seem to be an issue with Singleton OnDestroy not getting called. I believe it is because of exceptions being thrown on the OnDestroy method.
This is a really old sample. I think it won't be an issue. Going to update the sample in the package.json for 1.1.5
I just imported Basic Usage to the project and it has the same behavior but I used these repo samples or do you have a newer version on OpenUPM?
Hmm ok I'll try to dig in a little later. Thanks for reporting
Thanks for looking into it! I like Basic Usage samples looks clear!
Wow I've been digging in and this is a nasty bug. I'm still not 100% there.
It seems that the Singleton class I've been using from here is no longer working. https://wiki.unity3d.com/index.php/Singleton
It seems the m_ShuttingDown is not getting reset to false and so the singleton is returning null. This must be due to a change with 2020... I may need to ask on the forums.
I think perhaps it is the same thing causing the other issue where DataBindingConnection is not getting reset to null between runs in DataBinding.cs
This was an issue with Domain Reloading. For some reason in the example project "Enter Play Mode Settings" was checked but not "Domain Reloading"
Unchecking "Enter Play Mode Settings" in Project Settings > Editor fixes this issue.
I've got these errors in sample scenes: