Code Question: Game Start Event

Discuss modding questions and implementation details.
Post Reply
User avatar
joshcamas
Posts: 87
Joined: Mon Sep 21, 2020 7:01 am

Code Question: Game Start Event

Post by joshcamas »

I've been trying to register to "StartGameBehaviour.OnStartGame" to detect whenever the game starts. Reason being I want to add a component to the player and the player's camera. However, this event seems to never trigger. Is OnStartGame only for starting a new game? O_O

Thanks,
Josh

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Code Question: Game Start Event

Post by Ralzar »

You have to register a method to the event.

StartGameBehaviour.OnStartGame += MyMethod();

MyMethod()
{
code
}

User avatar
joshcamas
Posts: 87
Joined: Mon Sep 21, 2020 7:01 am

Re: Code Question: Game Start Event

Post by joshcamas »

Yes indeed, that is what I've been doing, but it doesn't trigger... :S

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Code Question: Game Start Event

Post by Ralzar »

Wait, when are you trying to have this trigger? I'm pretty sure OnStartGame is for when you start a new game. So not if you load a save.

User avatar
joshcamas
Posts: 87
Joined: Mon Sep 21, 2020 7:01 am

Re: Code Question: Game Start Event

Post by joshcamas »

Ahhh that explains it! I'll look for a load event then

Post Reply