common beta questions

-edit- apparently s p a w n gets edited to spawn so replace all the pawn with the word s p a w n(no es obviously) and you should be good. (seriously, s p a c e s get edited too?)

Hello everyone, here is a couple things that beta testers frequently had issues with:

creating variables and functions in c++ that can be accessed in blueprints

Functions:
in your header file:


UFUNCTION(BlueprintCallable, Category = Whatever)
void FunctionName(arguments);

//Variables:
UPROPERTY(EditDefaultsOnly, Category = Whatever)
float SomeVariable;

*the arguments for UFUNCTION and UPROPERTY are editable, and you should familiarizeyourself with all the variants.

Blueprints that are callable from any Object in the editor:
(thanks to Rama for this)

create a new class that extends from “UBlueprintFunctionLibrary”
example:


class UBPFunctionLibrary : public UBlueprintFunctionLibrary
//create your functions/variables with UFUNCTION and UPROPERTY, compile and enjoy ;)


sing a blueprint from c++:
//in your header file:


UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=BPSPAWN)
UBlueprint* BP_Item;
in your cpp file:
ItemIneritedFromt* ItemName= GetWorld()->SActor<ItemInheritedFromt>(BP_Item->GeneratedClass);
-or-
AActor* TestBPS = GetWorld()->SActor<AActor>(BP_Item->GeneratedClass);

inside the editor you will get a dropdown menu of all the potential things to spawn, make sure to do this before you play the game, or at least have it assigned before you try and spawn it.

FYI - Sorry for your issues with the word spawn. I’ve fixed the forum so that won’t happen in the future. Thanks for bringing it to our attention. :slight_smile: