12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Networking;
- public class LoadModelAB : MonoBehaviour
- {
- public GameObject Model;
- // Start is called before the first frame update
- void Start()
- {
- StartCoroutine(LoadAB());
- }
- IEnumerator LoadAB()
- {
- using (UnityWebRequest req = UnityWebRequestAssetBundle.GetAssetBundle("https://filebrowser.ghz-tech.com:8843/api/public/dl/1WZasi8T/unity/daping/main_1"))
- {
- yield return req.SendWebRequest();
- if (req.error == null)
- {
- AssetBundle ab = (req.downloadHandler as DownloadHandlerAssetBundle).assetBundle;
- Model = GameObject.Instantiate(ab.LoadAsset<GameObject>("main_1"));
- Model.transform.SetParent(this.transform);
- Model.transform.localEulerAngles = Vector3.zero;
- Model.transform.localPosition = Vector3.zero;
- // webglfont = ab.LoadAsset<Font>("simkai");
- }
- else
- {
- Debug.Log("ÏÂÔسö´í" + req.responseCode + "," + req.error);
- }
- }
- }
- // Update is called once per frame
- void Update()
- {
-
- }
- }
|