i am amking a unity 2D game and i have some variables of a preloaded GameObject that i want to refrence in a script of a prefab but i cant seem to be able to use the GameObject.FindWithTag("VariableName"); (to load the gameobject in the prefab) because the variable is a public ExampleName ExampleVariable instead of public GameObject ExampleVariable, so what im looking for is how to convert the ExampleName to GameObject so i can use .FindWithTag(); func for it,
public ExampleName ExampleVariable;
public GameObject ExampleVariable;
void Start()
{
ExampleVariable = ExampleName.FindWithTag("<GameObjectsName"); // i have this
ExampleVariable = GameObject.FindWithTag("<GameObjectsName"); // i need this
}
i havent really tried much because this is a solution to another problem that i had with refrencing variables in prefabs but i feel like this is the best way to solve the problem so any help would be appreciated.