I get this error in this script and I dont understand why??? or how to solve it.
Error:
ArgumentException: GetComponent requires that the requested component ‘GameObject’ derives from MonoBehaviour or Component or is an interface.
UnityEngine.GameObject.GetComponentInChildren (System.Type type) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineGameObjectBindings.gen.cs:59)
UnityEngine.GameObject.GetComponentInChildren[GameObject] () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineGameObjectBindings.gen.cs:80)
UnityStandardAssets.Characters.FirstPerson.ActionBarButtonDrag.Update () (at Assets/Scripts/ActionBarButtonDrag.cs:30)
namespace UnityStandardAssets.Characters.FirstPerson{
public class ActionBarButtonDrag : MonoBehaviour, IDropHandler {
public DragDrop dragDrop;
public InventoryV2 inventoryV2;
public ActionBar actionBar;
public Image itemIcon;
public int itemId;
public GameObject itemIconGO;
public Transform tempParent;
public GameObject erasedChild;
private int tempID;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(transform.childCount == 1){
erasedChild = gameObject.GetComponentInChildren<GameObject>();
}
}
}