I have a coroutine that drops seeds on ScriptA. Once it drops a seed to a position it changes the “position open” bool on ScriptA to false. When the player picks up the seed its script, ScriptB, updates the bool of ScriptA. However, the coroutine on Script A is always running so I am wondering if it knows the bool has been updated. I’m wondering because it doesn’t work…
I usually keep an empty scene in my project so I can go test things out when I’m not completely sure how they work. It can be valuable to strip everything away except for the specific thing you’re trying to test. This helps separate bugs in your logic from misunderstandings about how something works.
bool testValue;
IEnumerator TestCoroutine()
{
Debug.Log("Test Value: " + testValue);
yield return WaitForSeconds(1.0f);
}
void Start()
{
StartCoroutine(TestCoroutine());
}
void Update()
{
testValue = Input.GetKeyDown(KeyCode.Space);
}
}