UNITY动态加载预制体

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class LoadCube : MonoBehaviour {
 
	// Use this for initialization
	void Start () {
		GameObject hp_bar = (GameObject)Resources.Load("Cube");
		hp_bar = Instantiate(hp_bar); 
		hp_bar.name = "Cube";
	}
	
	// Update is called once per frame
	void Update () {
		
	}
}

  

posted @ 2022-01-20 09:16  多见多闻  阅读(591)  评论(0)    收藏  举报