Is it okay to use the KismetLibrary functions inside of C++?

I want to know if it is okay to call KismetLibrary functions from C++? Say I do the following:

//Say I call this with an include statement: #include "Kismet/KismetMathLibrary.h"

FRotator Rot = UKismetMathLibrary::FindLookAtRotation(this->TheMesh->GetComponentLocation(), target->GetActorLocation());

I know it can be called, but are there any drawbacks for doing it? I can also just go to the function and copy it and create my own, but would there be any performance hits if I just imported the library and used whatever function I wanted?

There are no drawbacks whatsoever! Its just like any C++ function.

So it’s perfectly fine to import a kismet library and then call it’s functions without any performance hits? If it is, is there a reason why people don’t do it more often considering a lot of the Kismet functions are more intuitive than the ones built inside of other libraries.

Here is another example:

//Imported #include "Kismet/KismetSystemLibrary.h"

//Inside of a function:

	// Trace using standard C++ trace method 

	static FName Searcher = FName(TEXT("Searcher"));
	FCollisionQueryParams TraceParams(Searcher,false, this->GetPawn());
	TraceParams.bTraceAsyncScene = true;
	TraceParams.bReturnPhysicalMaterial = false;

	FHitResult Hit(ForceInit);
	GetWorld()->LineTraceSingleByChannel(Hit, Start, End, ECC_Camera, TraceParams);*/

        // Trace using the method inside of KismetSystemLibrary

	FHitResult Hit(ForceInit);
	TArray<AActor*> toignore;
	UKismetSystemLibrary::LineTraceSingle_NEW(this, Start, End, UEngineTypes::ConvertToTraceType(ECC_Camera), false, toignore, EDrawDebugTrace::ForDuration, Hit, true);

Code has been reduced to 3 lines, and is much more intuitive (at least for me). But is there a performance hit? I certainly didn’t notice one but I’m sure small performance hits (if there are any) could add up. I just want to know if I can go on using methods like these (not all the time)?

Need more opinions before I go on using these

Kismet library is all static methods anyway, there is no penalty beyond the function call (which you would have in any normal C++ implementation anyway).

Yea they’re fine, they’re no different to regular C++ functions :slight_smile:

Just one thing to be aware of, make sure that whatever functions you’re trying to use are not part of the MINIMAL_API Macro (which you can find next to the class definition in the Header file). That Macro prevents those functions from being exported, so you can’t link against them when you compile and you’ll get compiler errors.

Okay great, thanks for the input everyone. I will probably only use the Kismet functions, at least the ones that are intuitive (not the ones which just call another C++) like the single line trace.