Event on view mode changed #122
-
I am comparing this C++ implementation versus the BP version. In the BP implementation, there is an event called "BPI Set View Mode" which can be used to trigger any custom code you may need to handle. Based on the C++ implementation, I cannot find anything equivalent to the BP version. Am I overlooking something. I see many functions defined for state changes, example OnViewModeChanged, however they are not events per say. Think for now, i will just implement my own DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnViewModeUpdated) and then broadcast this in the setviewmode function to broadcast the change has occurred so that I can implement my code based on this state change. No sure of the point of all those state change functions in the ALSBaseCharacter if they do not expose this to BP. Again, could be my lack of knowledge of this framework. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Ok, so this is what I did to ALSBaseCharacter In header file, I changed the existing OnViewModeChanged function to; in the CPP, I changed the signature of OnViewModeChanged to; Then in my BP, I then use the OnvViewModeChanged event, call parent implementation and then performed my custom bp stuff. Seems to be working, not sure if this is the correct way to implement this! |
Beta Was this translation helpful? Give feedback.
Ok, so this is what I did to ALSBaseCharacter
In header file, I changed the existing OnViewModeChanged function to;
UFUNCTION(BlueprintCallable, BlueprintNativeEvent,Category="ALS|State")
void OnViewModeChanged(EALSViewMode PreviousViewMode);
in the CPP, I changed the signature of OnViewModeChanged to;
void AALSBaseCharacter::OnViewModeChanged_Implementation(const EALSViewMode PreviousViewMode)
Then in my BP, I then use the OnvViewModeChanged event, call parent implementation and then performed my custom bp stuff.
Seems to be working, not sure if this is the correct way to implement this!