- Home /
Question by
Tom01098 · Jul 21, 2017 at 12:38 PM ·
c#scene-loadingeventdelegate
Subscribing to Unity Events with different signatures
I have a function that I want to call when the scene changes using the SceneManager.sceneLoaded event, but because it takes parameters of 'Scene' and 'LoadSceneMode', they are required by my function and are useless.
private void SetKeys(Scene useless, LoadSceneMode uselessAsWell)
Is there a way to remove the parameters but still receive the notification that a scene has loaded? Thank you!
Comment
Best Answer
Answer by iBicha · Jul 21, 2017 at 03:24 PM
Well, if these were missing, other people would complain because they wouldn't know what's loading.
if it really bugs you that much, you can do this
void Start () {
SceneManager.sceneLoaded += (arg0, arg1) => SetKeys();
}
private void SetKeys() {
//Do your thing here
}