-
Notifications
You must be signed in to change notification settings - Fork 251
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
What's The Proper Way To Get Game Object From Editor Script As A Buffer? #696
Comments
Hi, not sure I understand. You want to load a glTF-binary from a That is not really feasible. Do you mean you want to query (parital) information without displaying the scene or having the glTF's content show up? Please elaborate your use-case. |
Yes, correctly, because the intention is for this dynamic Game Object to be used as input for Unity's PreviewRenderUtility (AddSingleGO). It's not meat for a "Runtime" in Game, rather an Editor tool, but not using Unity's Import/Export menus. |
I see. You might have to create a custom IInstantiator, but maybe something like this does the trick: // asset_glb - httpResponse.Content.ReadAsByteArrayAsync().Result Buffer
var gameObj = new GameObject("root");
gameObj.SetActive(false);
gameObj.hideFlags = HideFlags.HideInHierarchy;
var gltf = new GltfImport();
await gltf.LoadGltfBinary(asset_glb);
await gltf.InstantiateMainSceneAsync(gameObj.transform); hth |
But this still requires it to run under Play Mode correct? Will throw the same error for Editor Window plugin. |
It should work in edit mode as well, as long as you don't run it async. See |
Thanks @atteneder I will give it a try! |
Hello!, hey there.
Considering a Unity Plugin/Tool based on a custom Editor Window, what's the correct approach to load a buffer and retrieve it's GameObject (no instancing, just dynamic reference of the game object)?
I'm not storing the file locally, project requires a buffer since it will be used just for rendering a thumbnail.
The text was updated successfully, but these errors were encountered: