how do I access variable or call a function from other script in unity
Accessing and modifying variable and calling from other script is quit simple. So in this post we access variable from other script and modify and call it. so lets get started. Lets create an empty scene in your project. In this scene create two empty game object and named them "variable and function script" and "test script". Now create two scripts one in which we declare variable and function named as "variable_function" and second by which we access these variable and call function named as "test". Drag and drop variable_function script in "variable and function script" gameObject and test script in "test script" gameObject. You can use any name of gameObject and script these names are just for reference so you can understand which gameObject and scripts I am talking about. variable_function script using System . Collections ; using System . Collections . Generic ; using UnityEngine ; public class variable_fun...