Search Issue Tracker

Fixed

Fixed in 2021.3.41f1, 2022.3.38f1, 6000.0.10f1, 7000.0.0a1

Votes

10

Found in

2021.3.3f1

2022.2.0a15

2023.1.0a13

2023.2.0a1

7000.0.0a1

Issue ID

UUM-2869

Regression

No

"Releasing render texture that is set as Camera.targetTexture!" error when calling Resources.UnloadUnusedAssets()

-

Reproduction steps:
1. Open the  attached "IN-4924" project
2. Build and Run the "SampleScene" scene
3. In the Build press the "Loop" button
4. Observe the messages in the log

Expected result: There are no error messages
Actual result: "Releasing render texture that is set as Camera.targetTexture!" error message appears

Reproducible with: 2019.4.39f1, 2020.3.35f1, 2021.3.3f1, 2022.1.3f1, 2022.2.0a15

Reproducible with: Vulkan, Direct3D11 and OpenGLES3 Graphics API's

Reproducible with: Windows Standalone Player

Not reproducible in the Editor (Windows 10)

Reproducible with these devices:
----------, Huawei - (ELS-NX9), Android 10, CPU: HiSilicon Kirin 990 5G, GPU: Mali-G76
----------, Samsung Galaxy Z Flip3 5G (SM-F711B), Android 11, CPU: Snapdragon 888, GPU: Adreno (TM) 660
----------, Samsung Galaxy S22 (SM-S901B), Android 12, CPU: Exynos 2200, GPU: Ltd.
----------, Samsung Galaxy S10+ (SM-G975F), Android 10, CPU: NOT FOUND, GPU: Mali-G76

Not reproducible with these devices:
iPhone 12 Pro (iOS 14.2.1), iPhone 6S (iOS 13.3.1)

Couldn't test with these devices:
​​​​​​​----------, Samsung Galaxy Note2 (GT-N7100), Android 4.4.2, CPU: Exynos 4 Quad 4412, GPU: Mali-400 MP (Older SDK)

Comments (5)

  1. ZorgUK

    Dec 08, 2023 13:55

    I don't use Addressables but was able to resolve the issue in my game in a similar way.

    I have a Camera prefab that has the targetTexture assigned that I would instantiate into the game scene and would work fine. But when that scene was unloaded I got the above error 100% of the time.

    Setting targetTexture to NULL in the prefab and then assigning it after instantiation fixes the issue for me.

  2. YMTIGER

    Dec 08, 2023 08:19

    Camera in an asset bundle in Addressables, RenderTexture asset to that Camera.renderTexture, and then put them all in an asset bundle. Then, it occurs error.
    If I set the BundleMode to 'Pack Separately', it stopped happening, but that's not a fundamental solution. Or you could create Camera.renderTexture dynamically and it might stop happening.

    https://forum.unity.com/threads/releasing-render-texture-that-is-set-as-camera-targettexture.1524775/

    I would like to know something about the status of the official investigation.

  3. ZorgUK

    Dec 08, 2023 07:58

    Has anyone found a workaround for this yet? Even destroying the camera object entirely a few frames before calling LoadScene() still results in this error.

  4. YMTIGER

    Dec 06, 2023 04:11

    Have you made any progress on this?
    I also get this error in WindowsPlayer with Resources.UnloadUnusedAssets();.
    I still get this error even if I set camera.targetTexture = null; in all Cameras.
    Is this an UnityEditor issue? Or is it my problem?

  5. dualcarbongames

    May 08, 2023 07:38

    if it helps, we faced this issue in our project(Unity 2021.3.23f @ Addressables 1.21.2) on android side mainly and only in builds(not in editor), we are releasing addressable handles(used to LoadAssetAsync and then Instantiated the loaded prefab with unity's Instantiate ) just before loading a new scene to free up memory space and it throws the same multiple errors, harmless at the moment as we are moving to next scene but its annoying to see a long list of errors and look for real errors in debugger.

Add comment

Log in to post comment