UnityGLTF icon indicating copy to clipboard operation
UnityGLTF copied to clipboard

GLTF models not openning in Unity 2017

Open smtabatabaie opened this issue 8 years ago • 4 comments

Hi, I'm trying to explore the sample project. I opened it in Unity 5.6.2 and I could open scenes like TestSceneScene without problem and see models. The problem is in Unity 2017.2 which doesn't load models in scenes like TestSceneScene , doesn't throw error though and stuck in "starting web server..." I'll appreciate if you can help me if you have succeeded in opening the project in Unity 2017 Thanks

smtabatabaie avatar Apr 10 '18 17:04 smtabatabaie

Did you try to view the models in Play mode? I'm using Unity 2017.3 and don't have any issues.

jasperdrescher avatar Apr 11 '18 17:04 jasperdrescher

Thanks , Yes of course, in TestSceneScene scene you have to play to be able to load the models.

smtabatabaie avatar Apr 11 '18 18:04 smtabatabaie

So I also encountered this issue. However, I initially received a 404 error from the webserver. To fix that issue I had to put the Assets located in the UnityGLTF-master\UnityGLTF-master\UnityGLTF\Assets\StreamingAssets folder into the UnityGLTF-master\UnityGLTF-master\UnityGLTF\www\glTF-Sample-Models\2.0 folder. After this, I encounted the error smtabatabaie describes. To fix this issue, I commented out line 212 of SimpleWebServer.cs: (context.Response.StatusCode = (int) HttpStatusCode.OK;)

It was causing an error preventing the code from reaching line 213 of SimpleWebServer.cs: (context.Response.OutputStream.Flush();)

Edit: I am using Unity 2017.2.0f3, Windows 10, 64bit

Scub3d avatar May 16 '18 03:05 Scub3d

I had a similar problem and there were 2 issues:

  1. The root path for the Web Server constructed by the script WebServerComponent.cs was malformed for the actual location of my "www" folder due to nesting.

  2. WebServerComponent.cs does not handle project names with spaces in them well and ends up not being able to find the correct root path. I figured this out by hard-coding the root path of the Web Server to the known good location and also using a little debugging. The changes I made are:

        //var wwwPath = appPath.Substring(0, appPath.LastIndexOf("Assets")) + "www";
        //hardcoding for this project is for dev only and above does not deal with spaces in project name well
        var wwwPath = "/Users/Shared/UnityProjects/My Project with spaces in name/Assets/UnityGLTF/www";
        Debug.Log("Web Server Root path:" + wwwPath);
    

Use the above debug statement and it should at least help you figure out where it things things live. But note that in my case, even though the requesting URI was correct, the way that wwwPath was constructed with appPath.Substring was not liking the spaces in the path name.

clstavros avatar Jul 09 '19 22:07 clstavros