Game Initialization API
open BaboonAPI.Hooks.Initializer
The initialization API lets you perform fallible setup tasks during game startup.
type ChimpanzeePlugin() =
inherit BaseUnityPlugin()
member this.Awake() =
GameInitializationEvent.EVENT.Register this
interface GameInitializationEvent.Listener with
member this.Initialize() =
GameInitializationEvent.attempt this.Info (fun () ->
raise (Exception "Oh no! We hit a problem while loading!")
)
Any exception thrown inside the initializer callback will be caught, and the game will safely stop loading and report the problem to the player.
C# Example
|
val raise: exn: System.Exception -> 'T