Unreal Engine C++ Useful Property Specifiers Basics
How To be Edit Variables in Properties windows ;
Some times we need to edit our properties from editor window (Properties Window of Actor or Pawn) without touch C++ code or class.
UPROPERTY(EditAnywhere , Category = "Category name") float ForwadForce = 2000.0f; // we edit this property in editor
Unreal Engine Gives you Power to change without code;
Expose Variable's in Blueprint
Declare a variable in C++ class and call it from Blueprint;
Multicast Delegates only. Property should be exposed for calling in Blueprint code ;
UPROPERTY(BlueprintCallable) float defalutHealth; // Blueprint Class the Value is Expose and we change it;
Expose but Read Only and Read-Write
Simply mean don't change the value but Blueprint class Expose it only;
UPROPERTY(BlueprintReadOnly) int32 Point = 10; // the value is don't changing in Blueprint Class UPROPERTY(BlueprintReadWrite) bool isGameOver = false; // we call it and write value // Note : Not call in same UPROPERTY these two Property Specifiers;
Showing All Properties but did not changes
We want to showing all properties don't changes or change it;
UPROPERTY( VisibleAnywhere ) UStatciMeshComponent* StaticMesh; // all properties showing in Properties window but don't edited // Note : This Specifier is incompatible with the "Edit" Specifiers
Call C++ Function In Blueprint
We made a function in C++ code or class. Now we want to call it from C++ class to Blueprint how to be that? Unreal Engine gives kinds of MACROS so we can easily call a specif function.
UFUNCTION ( BlueprintCallable , Category = "Category Name") float GetScore(float getScore); // if we call it in blueprint we can do
BlueprintCallable and BlueprintPure
The Main BlueprintCallable have a Execution Pin and BlueprintPure Dont have the used directly uses to object.
How to Override or Default Functions
So we made games and defiantly creating functions but some time we need to override functions C++ code or Blueprint like we want to same class to use our Hit or Overlap functions but we need to call it only in C++. How to works same in C++ and Blueprint??
Call MACRO BlueprintNativeEvent this is gives you ability to gives you override to blueprint functions;
This function is designed to be overridden by a Blueprint
UFUNCTION(BlueprintNativeEvent, Category="Tile Functions") void OnOverlapBegin(class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult); // blueprint native event now blueprint call it and define works!! void OnOverlapBegin _Implementation (class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult); // native event we call it c++ and make it useful
More Simple! > NativeEvent gives you ability call function and works with it same functions name;
More think You can use two types of Overlap Trigger's that's power of Blueprint And C++; Like C++ onOverlapBegin() function gives Effects and Blueprint onOverlapBegin() function gives you sound's of Walking or anything you definitions;
Meta Tags of Unreal Engine ;
Comments
Post a Comment