i want have global int in unity that i can access to variable without getcomponent for example we have 2 source code:
A.cs:
using UnityEngine;
using System.Collections;
public class A : MonoBehaviour {
global int health; //suppose we have global int in unity.
void Update () {
}
}
B.cs:
using UnityEngine;
using System.Collections;
public class B : MonoBehaviour {
void Update () {
health--; // i want have global int that i can call it without getcomponent.
}
}
Output:
health:
100
99
98
97
.
.
.
-infinity