Search Issue Tracker

Fixed in 7.3.0

Votes

18

Found in [Package]

6.9.1

Issue ID

1192259

Regression

Yes

[SRP only] Clearing playerprefs causes assets to reimport on playmode

Package: Scriptable Render Pipeline Lightweight

-

How to reproduce:
1. Open the attached "ReloadBug.zip" project
2. Load "SampleScene" scene
3. Enter and exit the Play mode multiple times (issue does not happen when entering the Play mode for the first time)

Expected result: minimal delay when entering the Play mode after the first time
Actual result: delay, that increases in parallel with the number of assets, appears when entering the Play mode again after the first time

Reproduced with: LWRP 6.7.1 (Unity 2019.2.0b1), LWRP 6.9.1 (Unity 2019.2.6f1), LWRP 6.9.2 (Unity 2019.2.11f1), URP 7.0.1, URP 7.1.2 ( Unity 2020.1.0a9)
Not reproduced with: LWRP 6.5.2 (Unity 2019.2.0b1)
Could not reproduce with: Unity 2017.4.33f1 (no Package Manager)

Notes:
- PlayerPrefs can be cleared by either using PlayerPrefs.DeleteAll() in a script or by using Edit -> Clear All PlayerPrefs
- sometimes "reimport" window briefly appears, inconsistent behaviour
- Console error ("NullReferenceException" or "MonoScriptImporterInspector.OnEnable must call base.OnEnable"), that is clearable or is cleared after restarting Unity (and does not appear again) can appear when entering the Play mode, however, error behaviour is inconsistent. Unknown reason as to what would make it appear after clearing PlayerPrefs and entering the Play mode
- after removing the script that would clear PlayerPrefs, the delay still happens for one more time when entering the Play mode
- reproduced on both Windows and Mac

  1. Response avatar

    Resolution Note (fix version 7.3.0):

    Fixed with 2020.1.0a26 (8.0.1), 2019.3.7f1 (7.3.1)

  2. Response avatar

    Resolution Note (fix version 7.3.0):

    Usage of playerprefs for URP settings has been removed, now a settings file is created in ProjectSettings

Comments (8)

  1. E89889fbd0cd85d12394e507aab5c79f?d=mm

    jason_yak

    Jan 22, 2020 07:47

    (this works for LWRP v6.9.1 at least)

  2. E89889fbd0cd85d12394e507aab5c79f?d=mm

    jason_yak

    Jan 22, 2020 07:47

    Got a work around finally. Store the lwrp string and reapply it before and after running a DeleteAll command.

    var lwrpVersion = PlayerPrefs.GetString( "LWRP-material-upgrader" );
    PlayerPrefs.DeleteAll();
    PlayerPrefs.SetString( "LWRP-material-upgrader", lwrpVersion );

  3. 81e26a65f5eab3ea39276d281b55bd46?d=mm

    miharataj

    Jan 16, 2020 11:33

    Is there a fix planned for one of the next versions?

  4. 53bac73f6961e58d1e951eaeb226052e?d=mm

    yakandco

    Jan 16, 2020 02:05

    Any progression on this issue? any indication of when it will be fixed. This has been an issue for over 6 months now and stifling our production to the point of testing in the editor being unusable. Having to wait for every asset to be reimported every time we run our app in the editor is such a horrible issue for our team.

  5. C684d6ce92ac1aa6aa02b67ddd3ac344?d=mm

    SempreGaming

    Dec 16, 2019 10:26

    Remoivng the key "LWRP-material-upgrader_h2399089941" at any point causes the above behavior.

    For the time being store all of your prefs in a class and access them via a wrapper. That class can then remove the player prefs at will.

    The SRP only tag is incorrect - it happens whether or not SRP is enabled as my project does not use lwrp/hdrp/srp

  6. E033fb132bc7ff4ba52c05daae5a9db8?d=mm

    StephanK

    Nov 26, 2019 09:59

    We were also running into that issue. I checked and it seems unity is now writing their own keys to PlayerPrefs. One of them contains the version of LWRP. If that's not there I assume unity triggers a reimport. I really think unity should not be writing anything into PlayerPrefs, this should be purely for game specific data.

  7. E89889fbd0cd85d12394e507aab5c79f?d=mm

    jason_yak

    Nov 25, 2019 16:01

    Yup we’ve had this issue for months and has really put the brakes on our production making it very difficult to test when we have to wait 10-20 minutes every play.

  8. Ccd0050e9725730ee65685704e888948?d=mm

    Time-Jockey

    Oct 30, 2019 00:16

    Having a very similar issue, but with URP

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.