using UnityEngine;using System.Collections;using System.Collections.Generic;public class GameManager...
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GameManager : MonoBehaviour {
private Transform startPoint;
private Transform spawnPoint;
private Pin currentPin;
public GameObject pinPrefab;
// 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)
}
}
老师,我在currentPin= GameObject.Instantiate(pinPrefab, spawnPoint.position, pinPrefab.transform.rotation)后面怎么打不出GetComponent ();这是为什么呢?显示Assets/Image/New Folder 2/GameManager.cs(31,17): error CS0266: Cannot implicitly convert type `UnityEngine.Object' to `Pin'. An explicit conversion exists (are you missing a cast?)