Download

Structure ref, how it works in BP?

Does the implemented method can using struct ref params and with it always reflected as a copy in BP?
Because I cant understand how it works… I’ve UPARAM(ref) but I can see that something not works as C++ reference


UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Setter")
void SetStructureByRef(UPARAM(ref) FStrWeapon& WpnStr);

@SetStructureByRef implementation
void AHardaWeapon::SetStructureByRef_Implementation(UPARAM(ref) FStrWeapon& WpnStr) {
    GetStructureByRef() = WpnStr;
}

@GetStructureByRef() implementation
UPARAM(ref) FStrWeapon& AHardaWeapon::GetStructureByRef() {
    retrun WeaponStructure;
}

// `WeaponStructure` it's a UPROPERTY from this class

There are dump if pointers when WpnStr updates WeaponStructure by ref of static struct, but as you can see from image below: not WpnStr and not WeaponStructure never get static struct pointer… So references for structures works or not, and how it must be used correctly in BP and C++?

](filedata/fetch?id=1808059&d=1599223270)​