Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhantomJS Linux binary missing #58

Open
michaelbianchini opened this issue Feb 28, 2018 · 9 comments
Open

PhantomJS Linux binary missing #58

michaelbianchini opened this issue Feb 28, 2018 · 9 comments

Comments

@michaelbianchini
Copy link

Not sure if this counts as a valid issue since it's sort of a feature request. I have Unity on Linux and when I drag a Twine HTML file into the Project, I get the following error:
NotSupportedException: Editor platform not supported.
Cradle.Editor.Utils.PhantomJS.Run[HarloweStoryData] (System.String url, System.String bridgeScriptFileName, Boolean throwExOnError) (at C:/Projects/(external)/Cradle/unity/Cradle/Assets/Cradle/.src/Cradle.Editor/Editor/Utils/PhantomJS.cs:23)
Cradle.Editor.StoryFormats.Harlowe.HarloweTranscoder.Init () (at C:/Projects/(external)/Cradle/unity/Cradle/Assets/Cradle/.src/Cradle.Editor/Editor/StoryFormats/Harlowe/HarloweTranscoder.cs:114)
Cradle.Editor.StoryImporter.Transcode () (at C:/Projects/(external)/Cradle/unity/Cradle/Assets/Cradle/.src/Cradle.Editor/Editor/StoryImporter.cs:44)
Cradle.Editor.CradleAssetProcessor.OnPostprocessAllAssets (System.String[] importedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at C:/Projects/(external)/Cradle/unity/Cradle/Assets/Cradle/.src/Cradle.Editor/Editor/CradleAssetProcessor.cs:83)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at /home/builduser/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:27)
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEditor.DockArea:OnGUI()

I downloaded the PhantomJS Linux 64 bit binary and I am going to try editing the code to add a case for it.

@michaelbianchini
Copy link
Author

I put the PhantomJS binary in and modified the code but when I import a story, it is not converted to a script but no errors are generated. I'll try to upload my branch to show what I've tried.

@michaelbianchini
Copy link
Author

@daterre I was unable to push a new branch but basically I added a Linux option to .src/Cradle.Editor/Editor/Utils/PhantomJS.cs and added the phantomjs binary to ThirdParty/PhantomJS/bin/linux/
Is Linux support do-able?

@daterre
Copy link
Owner

daterre commented Apr 18, 2018

Hi @michaelbianchini, sorry it took me so long to answer! Yes, totally doable. I don't really have the environment to test it at the moment thought - do you have your fork somewhere I can look at? Maybe it's a simple fix.

@michaelbianchini
Copy link
Author

Thanks @daterre ! No problem, I am just grateful you will help. I just pushed my changes to the fork I created with my username, can you see them? One is the PhantomJS.cs code, a one line change to find the linux binary, and the other is the linux binary itself.

@daterre
Copy link
Owner

daterre commented May 1, 2018

Hi @michaelbianchini, looking at the code section containing your fix:

// Get the location of the phantom exe
string phantomExecutable =
	Application.platform == RuntimePlatform.OSXEditor ? "phantomjs" :
	Application.platform == RuntimePlatform.WindowsEditor ? "phantomjs.exe" :
	Application.platform == RuntimePlatform.LinuxEditor ? "phantomjs" :
	null;

if (phantomExecutable == null)
	throw new NotSupportedException("Editor platform not supported.");

The exception you are getting can only happen if Application.platform is not one of the above. Could it be that Unity is reporting some other value there?

@michaelbianchini
Copy link
Author

michaelbianchini commented May 6, 2018

Thanks @daterre ! I just looked into it and it is still an issue, but it turns out I was not testing the changes until now.

I forgot to actually compile the changes (Monodevelop Buld All) and copy the dll to my Unity project. However, to get them to compile, I had to change the csproj file for MonoDevelop and another file or two ; I had to make changes similar to this commit:
6e43387#diff-69b31f30bd9ea86c963f859ecaa6077b
I also had to change the version of .NET for my system. I added some Debug but it is now showing up for some reason.

After making all the changes, I am still having the same issue (drag html file into Story field, nothing happens) I pushed all the changes to my fork, check them out and let me know what you think.

@daterre
Copy link
Owner

daterre commented May 21, 2018

thanks @michaelbianchini, I'll try to get a Linux environment up and running to start testing this stuff!

@stuarttempleton
Copy link

Is this going to land in an official release? I just hit the same place and noticed this thread while looking to see if anyone else has tackled this.

@daterre daterre added this to the Cradle 2.1 milestone Jan 22, 2019
@wilsonHodgson
Copy link

I don't know if this is related. But I get the same type of error on Linux when trying to add the current Cradle to my empty Unity 2019.3.14 project. (I ignored installing from the unity store because comments say v 2.0.1 is broken.

NotSupportedException: Editor platform not supported.
Cradle.Editor.Utils.PhantomJS.Run[ResultT] (System.String url, System.String bridgeScriptFileName, System.Boolean throwExOnError) (at C:/Projects/Demo-Wind/unity/Demo-Wind/Assets/Cradle/.src/Cradle.Editor/Editor/Utils/PhantomJS.cs:23)
Cradle.Editor.StoryFormats.Harlowe.HarloweTranscoder.Init () (at C:/Projects/Demo-Wind/unity/Demo-Wind/Assets/Cradle/.src/Cradle.Editor/Editor/StoryFormats/Harlowe/HarloweTranscoder.cs:114)
Cradle.Editor.StoryImporter.Transcode () (at C:/Projects/Demo-Wind/unity/Demo-Wind/Assets/Cradle/.src/Cradle.Editor/Editor/StoryImporter.cs:46)
Cradle.Editor.CradleAssetProcessor.OnPostprocessAllAssets (System.String[] importedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at C:/Projects/Demo-Wind/unity/Demo-Wind/Assets/Cradle/.src/Cradle.Editor/Editor/CradleAssetProcessor.cs:85)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.AssetPostprocessingInternal.InvokeMethod (System.Reflection.MethodInfo method, System.Object[] args) (at /home/builduser/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:714)
UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at /home/builduser/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:150)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants