Unity5質問スレ [転載禁止]©5ch.net
■ このスレッドは過去ログ倉庫に格納されています
0035名前は開発中のものです。
2015/08/05(水) 23:24:16.52ID:Wak/H5zkusing UnityEngine;
using System.Collections;
public class GatlingFire : MonoBehaviour {
public GameObject bulletprefab;
public float interval = 0.5f;
public float speed = 1000.0f;
private float nextFire = 0.0f;
private GameObject bullet;
void Update(){
if (Input.GetKey ("t") && Time.time > nextFire) {
nextFire = Time.time + interval;
bullet = Instantiate (bulletprefab, GameObject.Find ("Spawn").transform.position, Quaternion.identity);
bullet.GetComponent<Rigidbody>().velocity = Vector3.forward * speed;
}
}
}
というコードを書いたのですが、
Cannot implicitly convert type `UnityEngine.Object' to `UnityEngine.GameObject'. An explicit conversion exists (are you missing a cast?)
というエラーが出ます。ググってみたのですが、記述に問題はなさそうなんですが、どこかおかしいでしょうか?
どなたかわかる方よろしくお願いします。
■ このスレッドは過去ログ倉庫に格納されています