Question by
SADYYYYYYY · Aug 17, 2020 at 09:04 PM ·
variableintdecrease
I want to use one int in tow scripts and decrease it in the second one ,I want to use an int in tow scripts and I want to add to it
I want to use this int in the tow scripts: public int wood;
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 get 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?? Thanks for an answers,I want to use this int in tow scripts: public int wood;
This is my first script: public int wood;
private void OnTriggerEnter2D(Collider2D collision)
{
wood += 1;
}
and this is my second script: private void OnTriggerEnter2D(Collider2D collision) { } First I want to decrease the wood value in the second script by one how do I do that Second I want to use wood in both of them how do I do that
Comment