moba类游戏开发日志(二)Game视图中地图中“角色”的实例化

最后实现的效果如上图所示
简单的实例化比较简单,不考虑角色朝向以及在场景中的位置的话,只需要挂上如下脚本加载资源即可,默认实例化生成的地点是(0,0,0)
using System.Collections; using System.Collections.Generic; using UnityEngine; public class cleric : MonoBehaviour { public GameObject use_obj; // Start is called before the first frame update void Start() { GameObject prefab = Resources.Load("Prefabs/Player_cleric_sage_master") as GameObject; use_obj = GameObject.Instantiate(prefab); } // Update is called once per frame void Update() { } }
发表评论