Question by
bloxxyyy · Mar 15, 2020 at 09:25 PM ·
c#gameobjectprefab
Cant find gameoject by prefab
Using a raycast I am trying to get the gameobject I am currently pressing on. I get the gameobject however the following check fails
if (ObjSelectorModule.SelectGameobject() == playerUnit) Debug.Log("test");
The PlayerUnit variable takes as parameter a type of GameObject which I initialized in the inspector with a prefab of PlayerUnit
The expected result would have been that since the gameObject I am pressing is made from the prefab the check would have worked. However the check never activates. I am certain I am getting back the correct gameObject from the ObjSelectorModule.SelectGameobject() function.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612225027im_/https://answers.unity.com/themes/thub/images/avi.jpg)