Download

Reroute nodes or variables? Performance costs?

In theory would it be cheaper on performance to create a variable of a incoming reference and reuse it, or just drag reroute nodes of it and create a big spaghetti?

If I were to imagine this in terms of written code, it should look like this:

FunctionShoot(Damage)
{
ReduceHealth(Damage)
}

FunctionShoot(Damage)
{
TempDamage = Damage
ReduceHealth(TempDamage)
}

So temporary variable look heavier but honestly I don’t think it’s really relevant. And since I often end up modifying the parameter, I almost always create a temporary variable.

In BP, it is better to create readable functions and therefore, in this case it is better to create a local variable and use this, instead of keep reusing the parameter (and therefore create spaghetti code lol)