I'm using Scaleform in Unity. I'm currently having a problem where the swfMovies collection in SWFMovie isn't removing a movie that was currerntly on a Interface object that I am removing from my scene. Basically, if I select a menu, I will see my swf on a 3D object that I have in the scene. Once I close the object (I have it in a 2D Window), and try to reopen that menu, I get an exception thrown in SWFMovie that the movie already exists. Currently as a temporary fix, I remove the movie from swfMovies if it hasn't been. I apologize for the poorly formatted code below, but it wouldn't paste properly in the code block.
SFMgr = sfmgr;
this.SetFocus(false);
if(swfMovies.ContainsKey(name))
{
WeakReference theRef = swfMovies[name] as WeakReference;
if(theRef.IsAlive)
{
string err = "SWFMovie with this name: " + name + " already exists!";
// Temporary fix: Just remove the movie from the hashtable if it
// already exists and is alive
swfMovies.Remove(name);
// Old code
//throw new System.Exception(err);
}
else
swfMovies.Remove(name);
}
Is there a specific way to clean up SWFMovie? If so, where should that occur?
Thanks for the help!