You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GLTFast;
public class GLTFastTest : MonoBehaviour
{
// Start is called before the first frame update
async void Start()
{
// First step: load glTF
var gltf = new GLTFast.GltfImport();
// PATH TO GLB HERE
var success = await gltf.Load("C:\\Users\\USER\\Documents\\untitled.glb");
if (success) {
// Here you can customize the post-loading behavior
// Get the first material
var material = gltf.GetMaterial();
Debug.LogFormat("The first material is called {0}", material.name);
// Instantiate the glTF's main scene
await gltf.InstantiateMainSceneAsync( new GameObject("Instance 1").transform );
// Instantiate the glTF's main scene
await gltf.InstantiateMainSceneAsync( new GameObject("Instance 2").transform );
// Instantiate each of the glTF's scenes
for (int sceneId = 0; sceneId < gltf.SceneCount; sceneId++) {
await gltf.InstantiateSceneAsync(transform, sceneId);
}
} else {
Debug.LogError("Loading glTF failed!");
}
}
}
Start in Editor; everything works as expected
Build Project
Start exe
Monkey will not be instantiated as material will be null and throw a NullReferenceException
Expected behavior
Exported Project should behave the same as in Unity Editor
Desktop:
glTFast version: 6.10.1
Unity Editor version: 2022.3.0f1
Render Pipeline: Built-In render pipeline
Platform: Windows Player
The text was updated successfully, but these errors were encountered:
KDouble48
changed the title
Materials missing in after runtime import in exported project
Materials missing after runtime import in exported project
Feb 24, 2025
Describe the bug
Materials are missing after a runtime import in an exported project.
Only in exported project. It works fine in the Unity Editor.
Files
New Blender Monkey with a material
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Exported Project should behave the same as in Unity Editor
Desktop:
The text was updated successfully, but these errors were encountered: