yasirkula / UnityRuntimeInspector

Runtime Inspector and Hierarchy solution for Unity for debugging and runtime editing purposes
MIT License
1.75k stars 139 forks source link

Replace usage of ?? operator with safe null check #15

Closed apkd closed 5 years ago

apkd commented 5 years ago

The ?? operator performs reference comparisons and this can be problematic with UnityEngine.Object-derived objects which compare to null but aren't actually null references (eg. destroyed objects).

Explicitly null-checking the canvas.worldCamera property correctly uses the overridden operator which in turn avoids a potential bug.

yasirkula commented 5 years ago

Thank you for bringing this to my attention. I won't pull this PR because with each commit, I also try to release a .unitypackage. But I'll include this bugfix in the next release.