Skip to content

[BUG - Experimental] Astroneer: The Lua UnregisterHook function is not working as expected #1123

Description

@0-F

Branch or Release

  • UE4SS_v3.0.1-534-g49eda85 (works as expected)
  • UE4SS_v3.0.1-535-g4809391 (crashes the game)
  • UE4SS_v3.0.1-788-g9a20a8f - experimental-latest

Game and Engine Version
Astroneer - UE 4.27.2.0

Describe the bug
The Lua function UnregisterHook can cause the game to crash (with UE4SS_v3.0.1-535-g4809391).
With the latest experimental version (UE4SS_v3.0.1-788-g9a20a8f), the game no longer crashes, but it seems that the UnregisterHook function is not executed (and it is not logged in the UE4SS.log file).
The release "UE4SS_v3.0.1-534-g49eda85" works as expected.

Note that I do not encounter this problem with all hooked functions. For example, if I hook "/Script/Engine.PlayerController:ClientRestart" and I call UnregisterHook on it later, the game will not crash (everything is working correctly).
But if I do the same thing on "/Script/Astro.AstroCharacter:GetPlayController" or "/Script/Astro.DeformTool:HandleTerrainTool" then the game crashes (or, with the latest experimental release, UnregisterHook is not executed).

To reproduce

  • Edit UE4SS-settings.ini, add the engine version:
[EngineVersionOverride]
MajorVersion = 4
MinorVersion = 27
-- local hook = "/Script/Engine.PlayerController:ClientRestart" -- this hook works correctly
local hook = "/Script/Astro.AstroCharacter:GetPlayController" -- executed when you respawn and on game started
-- local hook = "/Script/Astro.DeformTool:HandleTerrainTool" -- executed when you equip the "Terrain Tool"

Pre, Post = RegisterHook(hook, function()
    print("hook", Pre, Post, "\n")
    UnregisterHook(hook, Pre, Post)
end)
  • Run the game.

.dmp file, UE4SS Log and UE4SS-settings.ini
ue4ss.zip

Desktop:

  • OS: Win10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions