Hello everyone. I am making a custom function that sets up a custom component I made. Here is my function btw:
UFUNCTION(BlueprintCallable, Category = "Vehicle|Engine", meta = (
ToolTip = "Setup the EngineAudioManager.\nDo this before starting the engine!\nAny inputs that are not set will not be used."))
void SetupEngineAudioManager(
UPARAM(meta = (DisplayName = "JoltVehicleComponent")) UJoltVehicleComponent* Vehicle,
UPARAM(meta = (DisplayName = "CombustionAudioComponent")) UAudioComponent* Combustion,
UPARAM(meta = (DisplayName = "IntakeAudioComponent")) UAudioComponent* Intake,
UPARAM(meta = (DisplayName = "ExhaustAudioComponent")) UAudioComponent* Exhaust,
UPARAM(meta = (DisplayName = "TurboAudioComponent")) UAudioComponent* Turbo);
The Vehicle input, sets a reference variable to a UJoltVehicleComponent. And if this variable is not set to anything, it will crash the editor. This function is used in a construction graph. So if its not set to anything, you can essentially get softlocked from the project. And since this variable is used over 200 times, adding if’s everywhere isn’t practical. So my question is if there is a way I make compiling fail if this input isn’t set? Like what happens if you don’t specify the class on the spawn actor from class node. Or is there another way to make this safe? Thank you!