using UnityEngine;
using System.Collections;
public class GameManager : MonoBehaviour {
private Transform StartPoint;
private Transform SpawnPoint;
public GameObject pinPrefab;
private Pin currentPin;
// Use this for initialization
void Start () {
StartPoint = GameObject.Find("StartPoint").transform;
SpawnPoint = GameObject.Find("SpawnPoint").transform;
SpawnPin();
}
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
}
}
void SpawnPin()
{
currentPin= GameObject.Instantiate(pinPrefab, SpawnPoint.position, pinPrefab.transform.rotation).GetComponent<Pin>();
}
}
第26行 currentPin= GameObject.Instantiate(pinPrefab, SpawnPoint.position, pinPrefab.transform.rotation).GetComponent<Pin>();没有GetComponent方法