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

Runtime Support #1

Open
ddutchie opened this issue Jul 12, 2019 · 8 comments
Open

Runtime Support #1

ddutchie opened this issue Jul 12, 2019 · 8 comments

Comments

@ddutchie
Copy link

ddutchie commented Jul 12, 2019

By making a couple of changes on my side, ** I now have a runtime** version of the importer script.
I have yet to test a build, which I assume will cause issues, but by isolating some things its not that Editor dependent, at least all the C# exposed in the release.

I cant see too deeply into the compiled dll's I would like a way to pass a bool to skip saving the asset to the project folder.

I want to add sketchfab support to my model viewer and I don't want to serialize the created asset..

@Stephengower
Copy link

I'm also looking for a runtime version of this. I swiped a lot of code from the importer class, and I am now able to search for, and download gltf files. But what I want (which I believe is what you also want) is a method that doesn't attempt to save a prefab (which only works in the Editor), and instead just returns a Unity GameObject. This is a great asset, but it seems like this is a big missing piece.

What seems to be the case is that sketchfab has worked to create a great asset for Unity developers. But it's not something that is set up to be used at runtime in games and applications built in Unity. That's a shame, because this would be (at least for me) really useful. They should look at the Google Poly Api. With that, a Unity application (not just the editor), can search for, download, and load models all at runtime.

@TeddyMathias
Copy link

@Stephengower Just echoing everything you're saying here. A runtime importer similar to Google Poly would be a game changer. Making this work at runtime across platforms would open up so many potential applications. Perhaps there's an opening for this, as it looks like Poly no longer is in active development of their Unity API. https://github.com/googlearchive/poly-toolkit-unity

@Stephengower
Copy link

Teddy, I did get something working that loads the GlTF models at runtime. You can't use the Sketchfab import code, because this does a full Unity import to save the GlTF as a prefab, and I'm pretty sure this uses some Editor-only code. But you can open GlTF files at runtime and instantiate GameObjects. The code for this exists within UnityGLTF which is what the sketchfab Unity asset was built upon. But the sketchfab version of UnityGlTF is stored into a .dll. I wanted access to the code, so I found the version of UnityGltf that Sketchfab is using (It's not the latest version), and then I removed the UnityGlTF.dll file and used the raw-code version instead. UnityGlTF has a test GlTFComponent.cs script that has code for opening a GlTF file and creating a gameobject.

I also made the sketchfab search work at runtime. I had to mess with it for a couple days, and don't remember exactly all I did, but I think the main thing I needed to do, was to change a lot of the code that was wrapped in #If UNITY_Editor, and remove this for certain methods.

So full runtime support is all doable (it's great!), but it requires some effort. In contract, as was already mentioned, the Google Poly API works fine out of the box at runtime for the searching, and loading of model.

In addition to full runtime support, what I'd really like to see is support for draco compression. Also it would be good if sketchfab allowed for the download of models that were optimized for games, especially VR. There's a pizza model in Sketchfab, and I think the .zip is like 40MB. So way to heavy and practical for a VR game. But if you compress all the textures, and if you could compress the meshes, it could look just about the same, but be probably 10x smaller in size.

@vaibhav-suri
Copy link

Anyone had any success with this issue?

@Feres-Othman
Copy link

any news about this ?

@zer0grand
Copy link

It's been a couple years since Sketchfab announced the intention of doing this on the forums... what happened?

@yosun
Copy link

yosun commented Oct 19, 2023

checking back

@TheWiselyBearded
Copy link

Hey all, check out the blog post and repository here for a runtime tool:
Blog Post
Repository

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

No branches or pull requests

8 participants