Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:? cannot be applied to Unity objects. #2405

Open
hubabenzarvt opened this issue May 22, 2023 · 1 comment
Open

:? cannot be applied to Unity objects. #2405

hubabenzarvt opened this issue May 22, 2023 · 1 comment

Comments

@hubabenzarvt
Copy link

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;

@vertxxyz
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants