using System.Collections; using System.Collections.Generic; using TriLibCore; using UnityEngine; public class StartLoadOtherModel : MonoBehaviour { public float bz1=0.1f; public string url; // Start is called before the first frame update void Start() { TriLibModelLoad.Load(url, (AssetLoaderContext ac) => { Debug.Log("模型加载完成"); }, (AssetLoaderContext ac) => { ac.RootGameObject.transform.localEulerAngles = new Vector3(0, 0, 0); ac.RootGameObject.transform.localPosition = Vector3.zero; Bounds bounds = GetAllBounds.GetRendererBounds(ac.RootGameObject); GameObject obj = new GameObject("Test"); obj.transform.position = bounds.center; obj.transform.SetParent(ac.RootGameObject.transform); float bizhi = bz1 / bounds.size.x; ac.RootGameObject.transform.localScale = Vector3.one * bizhi; ac.RootGameObject.transform.SetParent(this.transform); ac.RootGameObject.transform.localPosition = Vector3.zero - obj.transform.position ; ac.RootGameObject.SetActive(true); }, (AssetLoaderContext ac, float f) => { Debug.Log("加载中==》" + f); }, (IContextualizedError error) => { Debug.Log("加载失败" + error); }); } // Update is called once per frame void Update() { } }