I want to use this int in the two scripts: public int wood;
I want the value of the int to be the same in both scripts.
This is my first script:
public class Tree :
MonoBehaviour { public int wood;
private void OnTriggerEnter2D(Collider2D collision)
{
wood += 1;
}
}
This is my second script which I want the wood to use in it:
public class Base : MonoBehaviour {
private void OnTriggerEnter2D(Collider2D collision)
{
}
}
I want to decrease the wood value in OnTriggerEnter2D
. How do I do that?