I looked this up but it never fully works for some reason and it’s not 100% clear to me.
I am in script “A” and I want to access and change the value of a variable (an integer) which is stored in script “B”. Script A is a component of a game object in the scene and script B is a component of a prefab. How can I do this? I saw GetComponent is often used but when is GameObject.Find(…).GetComponent<…>() used and when is gameObject.GetComponent<…>() used? Is it when Script B is attached to a different game object compared to Script A? How do I do this whole thing, please help.
Thx in advance!