Open hubabenzarvt opened 1 year ago
This is a fairly old issue, but the above code is completely fine with UnityEngine.Object types. A ternary statement is just a fancy-looking if statement. It's not related to any of the things that make UnityEngine.Object types weird, like Unity null.
Perhaps there's something else about this issue that I'm missing.
Language Usage Opportunities, should be able to differentiate between unity objects and pure c# objects. Currently all contexts where the following pattern exists will be flagged up by the code analyser. However if the case is that Unity objects are included this should be suppressed.
Convert the following code: if (condition) x = expr1; else x = expr2; To: x = condition ? expr1 : expr2;