How you set up references to objects in game?

HI,

this is more of a best practices question.

I have some game objects with components to which I would need access from scripts on other objects.

The simplest way would be to name object with a tag, find it by tag on Awake/Start and set it to a variable and reference component with this variable. But as far as I understand - GameObject.FindWithTag() is pretty slow.

The other idea is to have a script with public variables corresponding to game objects. You set them manually in editor. Then in Start you set every GameObject variable to a public static variable and you can reference components on those object through this static variable. But this solution looks clunky.

So, how you do it? What are your best practices?

This is not a question for Unity Answers, this belongs to the forum. Look at the FAQs: Frequently Asked Questions - Unity Answers

The first point is that this is not for discussions. Talking about best practices is a LONG discussion, each method has it’s pros and cons and would fit better in different scenarios.