RegisterHook

The RegisterHook registers a callback for a UFunction

Callbacks are triggered when a UFunction is executed.

The callback params are: UObject self, UFunctionParams...

Returns two ids, both of which must be passed to UnregisterHook if you want to unregister the hook.

Any UFunction that you attempt to register with RegisterHook must already exist in memory when you register it.

Parameters

#TypeInformation
1stringFull name of the UFunction to hook. Type prefix has no effect.
2functionIf UFunction path starts with /Script/: Callback to execute before the UFunction is executed.
Otherwise: Callback to execute after the UFunction is executed.
3function(optional)
If UFunction path starts with /Script/: Callback to execute after the UFunction is executed
Otherwise: Param does nothing.

Return Values

#TypeInformation
1integerThe PreId of the hook
2integerThe PostId of the hook

Example

RegisterHook("/Script/Engine.PlayerController:ClientRestart", function()
    print("PlayerController restarted\n")
end)