FindObjectOfType doesn't work.

Hey.
I’m quite new and I’m trying to figure everything out.
Well,I’ve got an error.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class GameController : MonoBehaviour {

    private GameData test;
   
    public int score;
    // Use this for initialization
    void Start () {
        test = FindObjectOfType<GameData>;
       

    }

All help is appreciated.
Thanks for taking your time to help a newbie.

Greetings.

Add () after code

test = FindObjectOfType<GameData>();

Ah thanks a lot.

1 Like