Kink3d / kDecals

Projection Decals for Unity's Universal Render Pipeline.
MIT License
532 stars 53 forks source link

Unity 2020.2 - UnityException: GetRecorderInternal is not allowed to be called during serialization #33

Open adamgryu opened 3 years ago

adamgryu commented 3 years ago

I see this exception when loading the project in Unity 2020.2. The decals don't work unless I move m_RenderPass = new DecalRenderPass() into Create().

Perhaps unrelated, but after doing that, attempting to open the FrameDebugger crashes Unity.

CianNoonan commented 3 years ago

I've also found this to be faulty in 2020.2

adamgryu commented 3 years ago

Just as a heads up, I tried porting this forward to work in Unity 2020.2: https://github.com/adamgryu/kDecals

I also stumbled upon someone else who did the same thing. I don't know a lot about the URP, maybe they did it better! Dunno! https://github.com/dOObgames/kDecals

henriquebach commented 3 years ago

Have anyone found a solution for this?

fleity commented 3 years ago

the fix mentioned by adamgryu seems to work. Moving m_RenderPass = new DecalRenderPass(); in DecalRendererFeature.cs into the Create() Function resolves the error for me. I actually did not try this with this decal repository but Motion Blur and completely different TAA repo and they both now work.

StarManta commented 3 years ago

@adamgryu The project I'm on has this package added via the package manager, which (I believe) can only choose commits with tags to sync down. The most recent tag (2.0.0) is from a few days before this thread and does not have this fix, so I can't update (unless I remove the git from package manager and pull it down elsewhere, which is taking some steps backwards). Could you please push up a version with a tag on a commit with the fix?

CianNoonan commented 3 years ago

You should be able to define a specific commit sha in the packages lock file without having to have it tagged. Can you try that?

On Sun, 11 Apr 2021, 18:23 StarManta, @.***> wrote:

@adamgryu https://github.com/adamgryu The project I'm on has this package added via the package manager, which (I believe) can only choose commits with tags to sync down. The most recent tag (2.0.0) is from a few days before this thread and does not have this fix, so I can't update (unless I remove the git from package manager and pull it down elsewhere, which is taking some steps backwards). Could you please push up a version with a tag on a commit with the fix?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Kink3d/kDecals/issues/33#issuecomment-817341826, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACDZ73CJMBXOUTYTZKNJMN3TIHLH7ANCNFSM4WSQBELQ .

StarManta commented 3 years ago

@CianNoonan I don't seem to be able to. When I add in the SHA to the URL:

{
  "dependencies": {
    "com.kink3d.decals": {
      "version": "https://github.com/Kink3d/kDecals.git#a22ee8adf12f0fab5ff109931471fd7794555238",
      "depth": 0,
      "source": "git",
      "dependencies": {
        "com.kink3d.pooling": "0.1.0",
        "com.unity.render-pipelines.universal": "7.x.x"
      },
      "hash": "a22ee8adf12f0fab5ff109931471fd7794555238"
    },
    "com.kink3d.pooling": {

I switch to Unity, it says "Resolving packages" for a second, and then changes the file back to what it was, and the GetRecorder error is still there.

CianNoonan commented 3 years ago

Where did you get a22ee8adf12f0fab5ff109931471fd7794555238 from? I cant find that sha anywhere. a72ab04b0c37e03b13728f9c5f2b98bce9df7076 is the sha for the release 2.0.0 tag. What happens if you try using that

fleity commented 3 years ago

@StarManta hm I believe the reason it is not working is that you try to clone the repo from Kink3d's github but with adamgryu's commit hash? Which is kind of understandable since the readme is not updated automatically to reflect the new account when a repo is forked.

This works for me (specifying package dependencies the way you did doesn't): "com.kink3d.decals": "https://github.com/adamgryu/kDecals.git#a22ee8a",
"com.kink3d.pooling": "https://github.com/Kink3d/kPooling.git",

StarManta commented 3 years ago

Where did you get a22ee8adf12f0fab5ff109931471fd7794555238 from? I cant find that sha anywhere. a72ab04b0c37e03b13728f9c5f2b98bce9df7076 is the sha for the release 2.0.0 tag. What happens if you try using that

I don't need 2.0.0, that's the bugged one that I already have. a22 is the one adamgryu linked above, I'm confused what other commit you would think I would be trying in this thread other than "the fixed one"?

@fleity I tried that syntax as well, with the exact same result: Unity reverts packages-lock to what it looked like before and the bug remains.

CianNoonan commented 3 years ago

It sounds like an esoteric package manager issue if it keeps failing.

When I tried to add Adamgryu's repo locally I got some dependency errors. Are you sure its not erroring and then reverting to the last working version? image

adamgryu commented 3 years ago

Sorry you're having trouble with this. I don't plan to maintain my fork of kDecals (while I got my fork working, I introduced a serious performance issue by not culling during the kDecals pass - Unity kept crashing otherwise) so you might be better off just downloading a copy of the repo instead of using the package manager.