If I don’t use the property specifier BlueprintGetter and BlueprintSetter for the private variable Health , I can also use Getter and Setter function to access it in Blueprint, like this:
But if I delete the comment and use the specifier, I can access the private variable Health directly in Blueprint.Doing so destroys encapsulation, which is the opposite of the purpose of Getter and Setter functions.
So what’s the meaning of BlueprintGetter and BlueprintSetter ?
There is a old post about this topic, but I think their answer didn’t solve my problem, which is that the property specifier BlueprintGetter and BlueprintSetter aren’t actually needed at all.
I already know the answer. What these two property specifier do is like specifier ReplicatedUsing. They make marked function as a callback function. No matter what approach the BP side access the property,those access function will always be called.