reference has been placed
and when i play
but why is it still an error?
I’m stuck because I have followed exactly what was done in the video
reference has been placed
and when i play
but why is it still an error?
I’m stuck because I have followed exactly what was done in the video
Hi,
Please note, it’s better to copy/paste your code and apply the code fencing characters, rather than using screenshots. Screenshots are ideal for displaying specific details from within a game engine editor or even error messages, but for code, they tend to be less readable, especially on mobile devices which can require extensive zooming and scrolling.
You also prevent those that may offer to help you the ability to copy/paste part of your code back to you with suggestions and/or corrections, meaning that they would need to type a potentially lengthy response. You will often find that people are more likely to respond to your questions if you make it as easy as possible for them to do so.
Check if your “singleton” calls gameObject.SetActive(false);
in the same if-block where Destroy(gameObject);
gets called. If there isn’t that line of code, add it.
Hope this helps.
See also:
yes i have it in the ScoreKeeper.cs
Btw, i have fixed it
the start button can be pressed and it loads to the game scene, although the error sign still appears on the console.
I just had to move scoreKeeper.ResetScore();
under SceneManager.Load("Game");
line of code.
but its still not make sense, i think my Unity has error
Your Unity does not have an error. You dragged the prefab into the Start button’s click handler. The prefab does not have a reference to ScoreKeeper
. You have to drag the instance in the hierarchy to the click handler
This is wrong
It should be this
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.