SagaYuuki
(SagaYuuki)
June 23, 2023, 4:20am
1
Hello, I’m trying to give a default value to a function parameter that takes a reference parameter.
void ExampleFunc(float& TestFloat, bool& TestBool);
How would I give the function default parameters, or is it impossible for reference parameters?
Any help is greatly appreciated!
Reference means they are basically pointers to existing variables, passed by the caller.
It might be possible to make it point to a global/static variable by default, eg. something like :
static bool SomeBool = true;
void ExampleFunc(float& TestFloat, bool& TestBool = SomeBool);
This is most likely not gonna work as default value for the blueprints though.
You can’t provide defaults for non-const references. Defaults for const references is the same as with pass-by-value.