LoadSample.cs 1.2 KB

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