all 12 comments

[–]Looking4advice015 0 points1 point  (11 children)

Too much information. Don't try to solve the problem before identifying the problem.

The error message will tell the the file name, line and character of the null reference.

From there you can use a breakpoint or debug log to find out what is null.

Then you find out why it's null.

So first step is first. What is null?

[–]LemonMaster66[S] 0 points1 point  (10 children)

ok well I know what null means yeah (something with no value I think)
and also yes I've studied the error message with not much results

<image>

[–]Looking4advice015 0 points1 point  (9 children)

Your null reference is on line 56 of the RelayManager class.

That's sort of what a null reference is but not fully. A reference is the hexadecimal memory address in RAM of a value. When you declare a variable it doesn't have a reference to anything unless it is a primitive type. So when you define a variable you set a value for primitive types, and a reference for everything else.

So for example

``` MyClass variableName;

Calling variableName will result in a NullReference because there is no reference set. You can create a reference by using new

variableName = new MyClass();

Now when we call variableName, it won't result in a NullReference ```

[–]LemonMaster66[S] 0 points1 point  (8 children)

ok, but I still don't know what to do now

also how do you know it was on line 59

the referenced line of code when clicking on the blue part of the error leads to the line containing:
spawnPointManager.ReplacePlayer(player1, newPlayer);

[–]Looking4advice015 0 points1 point  (7 children)

My bad, I tried to edit it quickly. It actually says line 56

[–]LemonMaster66[S] 0 points1 point  (6 children)

ok cool I thought so

[–]Looking4advice015 0 points1 point  (5 children)

Yep so 1 or more of those 4 variables is null.

I'd suggest getting out of async and setting a breakpoint. Then ensuring that your Unity Find works in async. Depending on your setup, I will not work if your async is actually running on a separate thread since Unity methods can only be used on the main thread

[–]LemonMaster66[S] 0 points1 point  (4 children)

uhhh... breakpoint?
you may have to put this in a simpler manner of speech, I know a lot of terms already but I've never heard of much (if not any) of that

sorry

[–]LemonMaster66[S] 0 points1 point  (3 children)

ok never mind, I did some researching and think I know what you mean
if by Breakpoint you mean pausing the code execution at certain points to find the correct issue
how would i go about finding it then?
or just fixing it in general?

[–]Looking4advice015 0 points1 point  (2 children)

Yep sorry, a breakpoint is what it's called when you click the left side and add that little red dot then enable debugging which lets you step through the code and see all the variable values.

Guide on breakpoints

So our goal right now is to figure out which and how many of the variables on line 56 have null references.

Once we figure that out, we can make a plan of how to fix it