DeleGates And Events

Hi,

I am using a delegate/ event in my script in a scene called level1. In the scene Level2 i use the same scripts with the delegate / event in there.

My question is does the subscriber in the last loaded scene still subscribe to the event and cause it to run the code 2 times?

If i run each scene by its self it all works. If i run the scenes after each other the delegates run 2 times.

How do i unsubscribe to events before i load the next scene?

Thanks

If the object is still loaded, it is still subscribed.

-= is the syntax for unsubscribing.

Unity Coding Tips Part 1: Events and Delegates - YouTube is a very good resource for using Delegates and Events.

The eventmanager or eventlistener may have been loaded twice.

Check if u have used DontDestroyOnLoad function.