Question by
LunaD03 · May 21, 2018 at 06:15 PM ·
c#errorobjectscomparison
See if function returns a certain gameObject
Hi, so I have a function function()
which returns one of three gameObjects, which I'll just call obj1, obj2, obj3.
I have an if statement checking to see which one it returns, and it looks like this:
if (function() == obj3) {/*do stuff*/}
However, that gives me this error, Operator "!=" cannot be applied to operands of type "UnityEngine.Touch" and "UnityEngine.Touch"
What's wrong with this? I know that the function is returning an object, and that the object is the same one that I am comparing it to.
Help is greatly appreciated!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612163134im_/https://answers.unity.com/themes/thub/images/avi.jpg)