keijiro/KlakSyphon

metal:::g_Device error

Closed this issue · 7 comments

Hello,

thank You for this super useful package...

In Unity 2018.2.11f1 on Mac Os 10.13.2 High Sierra - when I try to use Klak Syphon by putting Syphon Server (Script) from the RUntime folder onto a Main Camera object I get the following errors:

Assertion failed on expression: 'metal::g_Device'
Klak.Syphon.SyphonServer:Plugin_CreateServer(String, Int32, Int32)
Klak.Syphon.SyphonServer:Update() (at Assets/Klak/Syphon/Runtime/SyphonServer.cs:105)

ArgumentException: nativeTex can not be null
UnityEngine.Texture2D.CreateExternalTexture (Int32 width, Int32 height, TextureFormat format, Boolean mipChain, Boolean linear, IntPtr nativeTex) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Texture.cs:347)
Klak.Syphon.SyphonServer.Update () (at Assets/Klak/Syphon/Runtime/SyphonServer.cs:108)

I can see the server is working in the client app (Millumin) but it shows a black screen with a red rectangle inside upon hitting "Play" in Unity and nothing else happens (Unity does render its graphics in the Game window properly...).

Is this due to Unity version newer than 2018.1 ?

EDIT: Just checked and the same situation happens in Unity 2018.1.8f1 on MacOs High SIerra 10.13.2

Thank You and kind regards

Thanks for reporting.

First of all, could you check if Unity is running on Metal? Please see the title bar of Unity Editor -- it should have <Metal> tag. If it only has <OpenGL> tag, your Mac device may not support Metal.

If you still have the same problem on a Metal-compatible device, please send the Editor log. I'd like to investigate what's happening in it.

Dear @keijiro
Thank You for Your response. Yes the Unity has the <Metal> in the title bar - now I'm testing on the Unity 2018.2.0b2, Mac OS 10.13.2

I managed to run Klak Syphon in a scene with no gameobjects, just the test Cube object - and it works fine on this version of unity. However in a more complex project I get the following error:

ArgumentNullException: Argument cannot be null.
Parameter name: shader
UnityEngine.Material..ctor (UnityEngine.Shader shader) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Shader.bindings.cs:104)
Klak.Syphon.SyphonServer.Update () (at Assets/Klak/Syphon/Runtime/SyphonServer.cs:117)

Please find the log attached.

Kind Regards

Editor.log

Thanks for the additional information.

I guess you're trying to add the server component to a game object (like AddComponent<SyphonServer>()) at runtime. Unfortunately, it isn't supported in the previous versions for some reason.

I updated the plugin to support this situation. Could you try it and check if the problem is resolved?

https://github.com/keijiro/KlakSyphon/releases/tag/v0.0.3

Dear @keijiro

Thank You for this update - it does work now!! Although as a side note I was never trying to add the component at runtime - I always added it before I pressed "Play" in Unity.

Anyway it works in the Editor however I also report the same issue as in another of the threads of Klak Syphon - I cannot build the application.

Upon building I get the following errors:

UriFormatException: URI scheme must start with a letter and must consist of one of alphabet, digits, '+', '-' or '.' character. System.Uri.Parse (UriKind kind, System.String uriString) System.Uri.ParseUri (UriKind kind) System.Uri..ctor (System.String uriString, Boolean dontEscape) System.Uri..ctor (System.String uriString) System.Xml.XmlResolver.ResolveUri (System.Uri baseUri, System.String relativeUri) System.Xml.XmlUrlResolver.ResolveUri (System.Uri baseUri, System.String relativeUri) Mono.Xml2.XmlTextReader.GetStreamFromUrl (System.String url, System.String& absoluteUriString) Mono.Xml2.XmlTextReader..ctor (System.String url, System.Xml.XmlNameTable nt) System.Xml.XmlTextReader..ctor (System.String url, System.Xml.XmlNameTable nt) System.Xml.XmlTextReader..ctor (System.String url) System.Xml.XPath.XPathDocument..ctor (System.String uri, XmlSpace space) System.Xml.XPath.XPathDocument..ctor (System.String uri) UnityEditor.BuildVerifier..ctor () (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildVerifier.cs:22) UnityEditor.BuildVerifier.VerifyBuild (BuildTarget target, System.String managedDllFolder) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildVerifier.cs:72) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Build completed with a result of 'Failed' UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0021f] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:187 at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x0007f] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:94 UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Editor.log

This is just a wild guess but I think this error is not relevant to KlakSyphon. Could you check if it can reproduce without KlakSyphon?

You're right - when I removed Klak it still refuses to build - sorry to bother you with it.

No problem. Thanks for clarification.

I'm closing this issue. Please feel free to reopen for further questions.