Hi, I have a question about concurrency, i cannot find answer anyware.
Example: I have two instance of prefab, prefabA and prefabB, each of them has an animation with a event, and than i have a singleton class with a function F.
I think it’s almost impossbile, but what happens if prefabA and prefabB events are called at same time and each of them call function F? In the following example can i be sure that F is called two times, sequentially? Or can it happens a concurrency situation, for example while F is executed by prefabA, prefabB call F and value become 2 before the if and //do stuff not executed?
Singleton class:
int value = 0;
public void function F()
{
value++;
if (value ==1)
{
// do stuff
value = 0;
}
}
Thanks