Check out example codes for "How to call a function in only one of many prefab clones". It will help you in understanding the concepts better.
Code Example 1
// idk about u, but by making my variables static, it worked for me // example: // do this private static GameObject player; // and not this private GameObject player;
Learn ReactJs, React Native from akashmittal.com