Skip to content

CallNativeFunction

Description

Sends a callback to the engine to run a native function. There are three versions of the function that can be used depending on the amount of parameters needed for the callback:

  • CallNativeFunction (no parameters)
  • CallNativeFunction2 (two parameters)
  • CallNativeFunction4 (four parameters)

In order to call a native function by name, a global variable named after the function must be added to the GameConfig. Once added, the engine will automatically set the value of the global variable to the ID of the native function.

Parameters

  • callback The index value of the callback.
  • param1, param2, param3, param4 Parameters to use for the callback.

Return Value

Depends on the callback used.

Syntax

CallNativeFunction(int callback)
CallNativeFunction2(int callback, param1, param2)
CallNativeFunction4(int callback, param1, param2, param3, param4)

Examples

CallNativeFunction(Disconnect2PVS)
CallNativeFunction2(TransmitGlobal, "vs.randomValue", vs.randomValue)
CallNativeFunction4(NotifyCallback, NOTIFY_STATS_ENEMY, StageStatsUsabilityParam1, StageStatsUsabilityParam2, StageStatsUsabilityParam3)

Native Functions

Function Description
SetAchievement Sets the status of the given achievement.
SetLeaderboard Submits the given score to the given leaderboard.
HapticEffect
Connect2PVS
Disconnect2PVS
SendEntity
SendValue
ReceiveEntity
ReceiveValue
TransmitGlobal
ShowPromoPopup
NativePlayerWaitingAds Creates a RewardAds native object, prompting the player to watch an ad.
NativeWaterPlayerWaitingAds Creates a RewardAds native object, prompting the player to watch an ad.
NotifyCallback Sends the given callback to communicate to Hedgehog Engine 2.

Decomp-Only Native Functions

Function Description
SetNetworkGameName
ExitGame Closes the engine.
FileExists Checks if a file exists in the Data assets.
OpenModMenu
AddAchievement
SetAchievementDescription
ClearAchievements
GetAchievementCount
GetAchievement
GetAchievementName
GetAchievementDescription
GetScreenWidth
SetScreenWidth
GetWindowScale
SetWindowScale
GetWindowScaleMode
SetWindowScaleMode
GetWindowFullScreen
SetWindowFullScreen
GetWindowBorderless
SetWindowBorderless
GetWindowVSync
SetWindowVSync
ApplyWindowChanges
GetModCount
GetModName
GetModDescription
GetModAuthor
GetModVersion
GetModActive
SetModActive
MoveMod
RefreshEngine