B
B
Bruh_Bruh2021-04-21 19:11:24
Unity
Bruh_Bruh, 2021-04-21 19:11:24

Why is the value of the generated class null?

private void Start()
    {
        grid = new Grid(100, 100, 10);
    }

if (Input.GetMouseButtonDown(0))
            {
                int width = grid.GetWidth(); <-- grid = null
            }


PS In general, I scored on initialization through a script and just made a GameObject with a script and without a constructor, now everything is fine.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question