B
B
BadCats2017-03-22 23:47:10
C++ / C#
BadCats, 2017-03-22 23:47:10

UI in Unity and NullReferenceException?

Here is the official video tutorial from unity https://unity3d.com/ru/learn/tutorials/projects/ro... - at the end of which the author makes a check

if(count>=12)
{
WinText.text="YouWin!"
}

I tried to do it differently, not limited to 12 or another constant, but by creating an array whose length is equal to the number of objects that can be collected on the playing field. The whole code is here: https://github.com/KucherenkoEgor/Rall-a-ball
But for some reason I get a NullReferenceException error. Tell me please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zelimkhan Beltoev, 2017-03-23
@BadCats

Maybe early in GameDev, when even NullReferenceException puts such a dead end? At first, at least with C#, can you figure it out?
Well, and so, your cube is not initialized and there is no check for this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question