Пожалуйста помогите, я не понимаю в чем проблема, почему вылетает ошибка?
Код
using UnityEngine;
using System.Collections;
public class GameController : MonoBehaviour {
public GameObject hookPrefab;
Grid grid;
void Start ()
{
grid = GetComponent<Grid>();
CreateHook();
}
public void CreateHook()
{
int action = Random.Range (0, 2);
Hook hook = Instantiate (hookPrefab, new Vector3((action * -21) + 16, 8, 0), Quaternion.identity) as Hook;
hook.SetParams(5, action);
}
}
NullReferenceException: Object reference not set to an instance of an object
GameController.CreateHook () (at Assets/Scripts/GameController.cs:25)
GameController.Start () (at Assets/Scripts/GameController.cs:18)