Skip to main content
added 176 characters in body
Source Link
Justin Markwell
  • 2.2k
  • 2
  • 14
  • 16
 public class Example2:MonoBehaviour{
 public static Example2 Instance;
 void Awake()
 {
     Instance = this;
 }
  //Now you can access the public methods or variable of Example2 from any class by 
  Example2.Instance.YourMethodOrVariable;
 }  
 //---------------------------------------------------------------------------------
 //But if you have a Boolean in your Example1 and don't want to make a whole Instance of the class you can
 public static bool example1ClassBool = false;
 //then from any other class you can use
 Example1.example1ClassBool = true;
 
 }//---------------------------------------------------------------------------------
 public class Example2:MonoBehaviour{
 public static Example2 Instance;
 void Awake()
 {
     Instance = this;
 }
  //Now you can access the public methods or variable of Example2 from any class by 
  Example2.Instance.YourMethodOrVariable;  
 
 //But if you have a Boolean in Example1 and don't want to make a whole Instance of the class you can
 public static bool example1ClassBool = false;
 //then from any other class you can use
 Example1.example1ClassBool = true;
 
 }
 public class Example2:MonoBehaviour{
 public static Example2 Instance;
 void Awake()
 {
     Instance = this;
 }
  //Now you can access the public methods or variable of Example2 from any class by 
  Example2.Instance.YourMethodOrVariable;
 }  
 //---------------------------------------------------------------------------------
 //But if you have a Boolean in your Example1 and don't want to make a whole Instance of the class you can
 public static bool example1ClassBool = false;
 //then from any other class you can use
 Example1.example1ClassBool = true;
 //---------------------------------------------------------------------------------
deleted 9 characters in body
Source Link
Justin Markwell
  • 2.2k
  • 2
  • 14
  • 16
 public class Example2:MonoBehaviour{
 public static Example2 Ex2Instance;Instance;
 void Awake()
 {
     Ex2InstanceInstance = this;
 }
  //Now you can access the public methods or variable of Example2 from any class by 
  Example2.Ex2InstanceInstance.YourMethodOrVariable;  
 
 //But if you have a Boolean in Example1 and don't want to make a whole Instance of the class you can
 public static bool example1ClassBool = false;
 //then from any other class you can use
 Example1.example1ClassBool = true;

 }
 public class Example2:MonoBehaviour{
 public static Example2 Ex2Instance;
 void Awake()
 {
     Ex2Instance = this;
 }
  //Now you can access the public methods or variable of Example2 from any class by 
  Example2.Ex2Instance.YourMethodOrVariable;  
 
 //But if you have a Boolean in Example1 and don't want to make a whole Instance of the class you can
 public static bool example1ClassBool = false;
 //then from any other class you can use
 Example1.example1ClassBool = true;

 }
 public class Example2:MonoBehaviour{
 public static Example2 Instance;
 void Awake()
 {
     Instance = this;
 }
  //Now you can access the public methods or variable of Example2 from any class by 
  Example2.Instance.YourMethodOrVariable;  
 
 //But if you have a Boolean in Example1 and don't want to make a whole Instance of the class you can
 public static bool example1ClassBool = false;
 //then from any other class you can use
 Example1.example1ClassBool = true;

 }
Source Link
Justin Markwell
  • 2.2k
  • 2
  • 14
  • 16

 public class Example2:MonoBehaviour{
 public static Example2 Ex2Instance;
 void Awake()
 {
     Ex2Instance = this;
 }
  //Now you can access the public methods or variable of Example2 from any class by 
  Example2.Ex2Instance.YourMethodOrVariable;  
 
 //But if you have a Boolean in Example1 and don't want to make a whole Instance of the class you can
 public static bool example1ClassBool = false;
 //then from any other class you can use
 Example1.example1ClassBool = true;

 }