Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: jess84 on August 15, 2013, 12:56:36 PM

Title: Playmaker windows empty, cannot restore views, cannot use Playmaker!
Post by: jess84 on August 15, 2013, 12:56:36 PM
During normal usage, not changing any layout views, my FSM window became blank, and the following error was displayed:

InvalidCastException: Cannot cast from source type to destination type.
HutongGames.PlayMakerEditor.FsmEditorUtility.LoadDllResource (System.String resourceName, Int32 width, Int32 height)
HutongGames.PlayMakerEditor.FsmEditorStyles.InitCommon ()
HutongGames.PlayMakerEditor.FsmEditorStyles.Init ()
HutongGames.PlayMakerEditor.FsmEditor.OnGUI ()
FsmEditorWindow.DoGUI () (at Assets/PlayMaker/Editor/FsmEditorWindow.cs:94)
HutongGames.PlayMakerEditor.BaseEditorWindow.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

Changing the layout to another didn't fix the problem - I then just ended up with my other layout and a floating Playmaker tab. Resetting to factory defaults managed to remove it, but now I can't add a playmaker tab as I always get the floating (but empty) display.

Help!
Title: Re: Playmaker windows empty, cannot restore views, cannot use Playmaker!
Post by: jess84 on August 15, 2013, 01:06:36 PM
As there was an update to 1.6.2, I updated. However when I get to add my playmaker window - the same problem.  :(
Title: Re: Playmaker windows empty, cannot restore views, cannot use Playmaker!
Post by: jess84 on August 15, 2013, 01:17:58 PM
OK, I've created a new project - reset the views, and reimported Playmaker... and it's working fine.

However on my actual project, when I load it... the same problem!! And in the inspector, if I click on an FSM on one of my objects, it doesn't drop-down to show information about that FSM!

Please tell me I have not lost ALL of my work in my FSMs!!?

None of my FSMs in ANY of my scenes in this project are accessible now.
Title: Re: Playmaker windows empty, cannot restore views, cannot use Playmaker!
Post by: Alex Chouls on August 15, 2013, 04:06:34 PM
What version of PlayMaker are you using? The latest version is 1.7.0 and it should fix this...
Title: Re: Playmaker windows empty, cannot restore views, cannot use Playmaker!
Post by: jess84 on August 15, 2013, 04:22:04 PM
1.7.0.

Reimported Playmaker, and it's still not working.  The error message given above is the same, and spams the console every second.
Title: Re: Playmaker windows empty, cannot restore views, cannot use Playmaker!
Post by: jess84 on August 15, 2013, 04:27:58 PM
Has this permanently screwed up the FSMs in the project?!
Title: Re: Playmaker windows empty, cannot restore views, cannot use Playmaker!
Post by: Alex Chouls on August 15, 2013, 04:48:05 PM
The FSMs should be fine. If you don't open the editor but instead look at the PlayMakerFSM inspector do you get any errors?

FsmEditorUtility.LoadDllResource loads editor textures from the Playmaker dll. However there is a mechanism where it can load a local version of the texture from a Resource folder. So you might have a texture with the same name in your project but of a different type that's throwing the error...

Just to quickly test if that's the problem:

Copy the project.
Download the attached Resources.zip.
Unzip the contents into Assets/PlayMaker/Editor/Resources/
Reload the project.

It should find the local resources in that folder instead of any in your project. Or you could check that folder for duplicates that you might have in your project.

I'll change this in 1.7.1 so the Playmaker Editor doesn't try to load local textures.

If that's not the problem, another thing you could try:

Copy the project
Delete the Library/ScriptAssemblies folder
Reload the project

If neither of these helps, you could send me the project and I'll take a look at it...
Title: Re: Playmaker windows empty, cannot restore views, cannot use Playmaker!
Post by: jess84 on August 15, 2013, 05:19:13 PM
Ok, neither of those 2 suggested fixes worked.

However based on what you said the cause might be, I deleted the last 2 gameObjects and Materials that I created (Sphere, Sphere 1 / Yellow, Red) and that has fixed it.

Are there some asset names that need to be avoided in order for this to not happen again? E.g. should I be looking through one of the playmaker folders and identifying names I shouldn't use?

Thanks for the quick response on this though. I was getting a bit panicky!
Title: Re: Playmaker windows empty, cannot restore views, cannot use Playmaker!
Post by: Alex Chouls on August 15, 2013, 05:36:58 PM
Someone had a similar problem, I believe with the Shadow Map material...?

It seems like some unity materials/shaders might leak draw state into the editor causing problems.

Can you easily reproduce the problem by adding a material? Can you send me that material?

EDIT: Also you should be using version control :) Helps with the panic! You can always roll back to a working version, and you can see exactly what you've changed...
Title: Re: Playmaker windows empty, cannot restore views, cannot use Playmaker!
Post by: jess84 on August 15, 2013, 05:46:00 PM
Yeah, I know  :D  However at the moment I'm just testing things out to get used to various Unity/PM functions.

I've tried recreating those objects/materials, but it didn't cause the problem to reoccur. They were only default spheres and default materials, nothing specials (for placeholder test assets).

I did have Photon components attached to them though, I don't know if that's relevant.
Title: Re: Playmaker windows empty, cannot restore views, cannot use Playmaker!
Post by: jess84 on August 15, 2013, 05:50:46 PM
Just loaded the original project (rather than the copy), and deleted things one-by-one.

The culprit was a basic Material (e.g. Create new Material, renamed it "Yellow", changed the Main Colour). Don't know if it makes a difference, but the project didn't contain another material (in any folder) titled the same.

Edit:  Just recreated the problem.  As above, but moved the material into a folder called 'Resources'.  Might be conflicting with some Photon stuff? As that's where my player prefabs and stuff for Photon instantiating are.
Title: Re: Playmaker windows empty, cannot restore views, cannot use Playmaker!
Post by: Alex Chouls on August 20, 2013, 11:09:33 PM
This will be fixed in the next update. Thanks for catching this!