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

Error - SPCRJointDynamics does not work properly #10

Open
tomcup opened this issue Dec 22, 2022 · 3 comments
Open

Error - SPCRJointDynamics does not work properly #10

tomcup opened this issue Dec 22, 2022 · 3 comments

Comments

@tomcup
Copy link

tomcup commented Dec 22, 2022

Error Message:

Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
The following scene GameObjects were found:
SPCRJointDynamicsJobManager

My English level is very poor, so the following may be strange.........

This is what I did just now:

  • Open the project
  • Install SPCRJointDynamics
  • Add some "points" and "colliders" to my character
  • Run (everything is OK)
  • Stop (No problem, still)
  • Run again
  • Stop (Error: I got the above error)
  • Run (SPCRJointDynamics unable to work properly)
    This is what I see while running for the last time:
    image
    Then no matter how many time I Run or Stop, SPCRJointDynamics unable to work properly as shown in the picture above.

I found a way to avoid the problem for one time is that disable all the controller:
image
Then Run, though it still doesn't work, it can work properly for the next time I Run.
But the Error is still there if I Run for one more time.

Update on 2022.12.23:(use translator)
There is a strange phenomenon that every time the error appears, the problem that SPCRJointDynamics cannot work properly will occur. So I guess the problem may occur in the Destroy logic of SPCRJointDynamicsJobManager or somewhere else.

I used HDRP in my project, but according to the error message, this error is about Jobs system, not HDRP or something else.
I don't have the time or ability to read the code and make possible suggestions, the whole system is too complicated for me.

Oh, My English is so bad...

@tomcup tomcup changed the title Error - "Some objects were not cleaned up when closing the scene. " Error - SPCRJointDynamics does not work properly Dec 23, 2022
@tomcup
Copy link
Author

tomcup commented Dec 23, 2022

I found that the main problem of SPCRJointDynamics isn't here, there is a easy way to prevent the error from unity.

// SPCRJointDynamicsJobManager.cs
// Line 25
List<SPCRJointDynamicsController> _Controllers = new();

+ private static bool _applicationIsQuitting = false;

// Line 29 now
static public SPCRJointDynamicsJobManager Instance
{
    get
    {
+       if(_applicationIsQuitting)
+       {
+           return _Instance;
+       }
        if (_Instance == null)
        {
            GameObject obj = new GameObject("SPCRJointDynamicsJobManager");
            DontDestroyOnLoad(obj);
            _Instance = obj.AddComponent<SPCRJointDynamicsJobManager>();
        }
        return _Instance;
    }
}

// Line 68
private void OnDestroy()
{
    StopCoroutine("EndOfFrame");
+   _applicationIsQuitting = true;
-   _Instance = null;
}

But the real problem like the picture as shown below after running once is still happened (I moved the character at runtime):
image
Although there is no error in the console window, the main problem is not reported by Unity:
image

@NoriyukiHiromoto
Copy link
Contributor

We will check for errors.

@NoriyukiHiromoto
Copy link
Contributor

Could you try the latest version?

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