I tried to get the variable nbullet from the script Control of the GameObject Player, I wrote this script:
using UnityEngine;
using System.Collections;
public class Info : MonoBehaviour {
public int nbullet;
public GameObject player;
void Start () {
}
void Update () {
player = GameObject.Find("Player");
nbullet = GetComponent("Control").nbullet;
}
}
but it tells me this error:
Assets/Info.cs(29,52): error CS1061: Type UnityEngine.Component’ does not contain a definition for nbullet’ and no extension method nbullet’ of typeUnityEngine.Component’ could be found (are you missing a using directive or an assembly reference?)
why? how can I fix this?