LoadSample.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using TriLibCore;
  4. using UnityEngine;
  5. public class LoadSample : MonoBehaviour
  6. {/// <summary>
  7. /// The Model URL.
  8. /// </summary>
  9. string ModelURL = "https://ricardoreis.net/trilib/demos/sample/TriLibSampleModel.zip";/// <summary>
  10. /// The Model URL.
  11. /// </summary>
  12. string ModelfILE = "D:\\JiHe\\MMD20230728021557 (1)\\Unity2GLTF.gltf";
  13. // Start is called before the first frame update
  14. void Start()
  15. {
  16. TriLibModelLoad.Load(ModelURL, (AssetLoaderContext ac) => {
  17. Debug.Log("模型加载完成");
  18. }, (AssetLoaderContext ac) => {
  19. Debug.Log("载材质加完成");
  20. ac.RootGameObject.transform.position = Camera.main.transform.forward;
  21. }, (AssetLoaderContext ac, float f) => {
  22. Debug.Log("加载中==》" + f);
  23. }, (IContextualizedError error) => {
  24. Debug.Log("加载失败" + error);
  25. });
  26. TriLibModelLoad.Load(ModelfILE, (AssetLoaderContext ac) => {
  27. Debug.Log("模型加载完成");
  28. }, (AssetLoaderContext ac) => {
  29. Debug.Log("载材质加完成");
  30. ac.RootGameObject.transform.position = Camera.main.transform.forward;
  31. }, (AssetLoaderContext ac, float f) => {
  32. Debug.Log("加载中==》" + f);
  33. }, (IContextualizedError error) => {
  34. Debug.Log("加载失败" + error);
  35. });
  36. }
  37. // Update is called once per frame
  38. void Update()
  39. {
  40. }
  41. }