GameManger中的代码
using UnityEngine;
using System.Collections;
public class GameManager : MonoBehaviour {
private Transform StartPoint;
private Transform SpawnPoint;
public GameObject Pin;
// Use this for initialization
void Start () {
StartPoint = GameObject.Find("StartPoint").transform;
StartPoint = GameObject.Find("SpawnPoint").transform;
SpawnPin();
}
void SpawnPin()
{
GameObject.Instantiate(Pin, SpawnPoint.position, Pin.transform.rotation);
}
}
运行与报错
其他物件的设置
还有只能在旁边的Inspector创建脚本 在scripts中拖拽脚本报错 不能找到class