- Home /
 
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
Answer by kevork · Jan 26, 2012 at 12:36 AM
If the object is still loaded, it is still subscribed.
is the syntax for unsubscribing.
http://www.youtube.com/watch?v=N2zdwKIsXJs is a very good resource for using Delegates and Events.
Yeah i put debugs in that and its connecting and releasing ok seams there is a bug else where
Answer by hotshot03 · Mar 04, 2013 at 10:56 AM
The eventmanager or eventlistener may have been loaded twice.
Check if u have used DontDestroyOnLoad function.
Your answer
 
             Follow this Question
Related Questions
Question about unsubscribing eventhandlers OnDisable and OnEnable 2 Answers
How to unsubscribe from a delegate that is inside of a singleton? 2 Answers
Making Multiple Switches Affect Different GameObjects 0 Answers
Method doesn't get implemented after subscribing to Func 1 Answer
Is there any event or delegate that is called with OnValidate() ? 0 Answers