Hi every one,
So I found myself using this sort of code pretty often and I thought there are probably 100 ways to make it better.
bool actuated;
void Update () {
if (!actuated)
{
if ( some condition here )
{
actuate();
}
}
}
void actuate()
{
// do stuff
actuated = true;
}
private void OnDisable()
{
actuated = false;
}
basically I want some method being executed once when something happens.
What i feel is not a good idea :
-it now checks every update for a condition.
-having to manage a flag manually.
How would you do it so it’s faster to type or cleaner to read or more efficient?
Thanks