Which One Is the Better Practice? Public GameObject or FindwithTag?

Hello,

Which one is the better practice in general?

Should I call functions by grabbing the relevant script with findwithtag at the start or should I use public GameObject to assign the relevant object manually?

I’m asking it for my gamemanager script, which I assign it to an empty object on the hierarchy.

Thanks in advance.

Lets say,

everything is better most of the time then using “GameObject.FindWithTag” or “Class”.

If you have the chance, assign it manually, but try to keep your code as simple and clean as possible,
since nobody wants to assign 100s of things in the Inspector.

In terms of UI, there are many different ways to achieve those couplings but in terms of gameplay and so on, assign it manually.

1 Like