Smooth Operator

Smooth Operator is a Unity extension that allows the use of the null conditional operator (?.) and the null coalescing operator (??) on Unity GameObjects. Unity’s implementation prevents users from using these powerful C# operators in standard Unity scripts. Smooth Operator changes all of that by allowing users to take advantage of these operators in their code. Simply add the extension from the Unity Asset Store and import the package into your project, Smooth Operator will handle the rest, with no configuration needed. All platforms are supported. Build pipelines are also supported.

It just works.

Change the paradigm in your project using modern clean tools. Unlocking powerful null operators will add new dimensions to your development powers.

FAQs

Why wont the null conditional operator work without this extension?

Unity has a custom == operator implementation that checks if an object has been destroyed on the C++ side. The ?. and ?? operators cannot be overridden, so they cannot use this custom implementation that Unity has created. Smooth Operator fixes this and allows them to be used with the expected results.

Are there any performance considerations?

Under the hood Smooth Operator transforms your code from simple null check to using Unity’s overloaded null check. Using Unity’s overloaded method has a negligible performance hit. Using Smooth Operator is exactly as performant as a regular null check in an if statement.

What sort of witchcraft is this?

It’s the regular kind, where an engineer wished they had a feature, and was too dimwitted to realize that what they wanted was impossible. So they built it.

Get in touch.

Please contact us with any concerns or questions regarding Smooth Tools. If you are reaching out about support for a product, please include your Unity invoice number in the message.