Can anyone confirm? PresetManager Broken 2021.3

nimbo

New member
Disclaimer: I haven't used Unity in quite some time and it's possible it's an issue I am causing.

As soon as I add the UCC (Third Person only license) package to my project the Unity PresetManager stops working. By preset manager I am attempting to click the presets button in the inspector to create or switch unity presets and a NullReferenceException occurs.


Fresh Unity Editor Install: 2021.3.18f1 (Have tried a few versions)

1) New 3D URP Project
2) Test presets button and selection window opens
3) Add UCC Package and install
4) Test presets button and no window comes up but a NullReferenceException is occuring.

I understand the PresetManager throwing the exception is unity code but it works up until I add the UCC to the project

Thanks in advance

--- small portion of trace ---
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Presets.PresetSelector+<>c__DisplayClass24_0.<FindAllPresetsOfType>b__1 (UnityEditor.Presets.Preset preset) (at <42a64fd733d9417da1ea3a757ad9a96d>:0)
System.Linq.Utilities+<>c__DisplayClass1_0`1[TSource].<CombinePredicates>b__0 (TSource x) (at <820418806247485ca814d3202155407f>:0)
System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].ToArray () (at <820418806247485ca814d3202155407f>:0)
System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <820418806247485ca814d3202155407f>:0)
UnityEditor.Presets.PresetSelector.UpdateSearchResult (System.Int32 currentSelection) (at <42a64fd733d9417da1ea3a757ad9a96d>:0)
 
Thanks Justin.

Using the link you posted I was able to narrow this down. This is all being caused because your base Preset class is getting caught up in this by some bad reflection code i'd guess.

Solution:
Locate ./Opsive/Shared/StateSystem/Preset.cs
Rename the file and class from Preset to OpsivePreset and update references
Using a good IDE should be able to do this step for you if you highlight the class name and hit F2 or another rename option. There is already a FormerlySerializedAs attribute and should be no reason to do anything else. Make sure to NOT rename the PersistablePreset class by doing a find and replace or you will end up not being able to use any of your existing presets.

Reason:
I'm not 100% sure what is occurring and I stopped looking once I found the fix but just having a ScriptableObject with Preset.cs in your project alone does not cause the issue.
 
Last edited:
Top