In the game I am doing has an actor that follows around the main actor Sam and Max style.
I did a search on the forums and found some cool code in which you create an infinite loop in the second actors script in which it checks for a true boolean variable in an overwritten GoTo method in the first actor's script. If it finds it, it sets that boolean value to false, checks if the second actor is already walking and stops it if it is. It finally calls its own GoTo method with the first actor's targetX and targetY as parameters and then sleeps for 100ms.
This was working great as the second actor would move with the first (as opposed to waiting for the first to finish moving before setting off).
But then I added a second scene. Then whenever I changed to that scene (or back again for that matter) the second actor would appear where I SkipTo()ed him but would not follow anymore.
After about an hour pouring over the code to find what I did wrong I noticed that the actor\secondactor was missing from the top left corner of the debugging window. Seemingly when I changed scene the game unloaded the second actor and its scripts. I messed around a bit more and found that taking out the loop kept everything fine.
Is this a bug, is there some condition I should be setting on a loop to keep it safe during scene changes or is there a better way of having a second actor follow the first where I wont encounter this problem?