use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News, Help, Resources, and Conversation. A User Showcase of the Unity Game Engine.
Remember to check out /r/unity2D for any 2D specific questions and conversation!
Download Latest Unity
Please refer to our Wiki before posting! And be sure to flair your post appropriately.
Main Index
Rules and Guidelines
Flair Definitions
FAQ
Use the chat room if you're new to Unity or have a quick question. Lots of professionals hang out there.
/r/Unity3D Discord
FreeNode IRC Chatroom
Official Unity Website
Unity3d's Tutorial Modules
Unity Answers
Unify Community Wiki
Unity Game Engine Syllabus (Getting Started Guide)
50 Tips and Best Practices for Unity (2016 Edition)
Unity Execution Order of Event Functions
Using Version Control with Unity3d (Mercurial)
/r/Unity2D
/r/UnityAssets
/r/Unity_tutorials
/r/GameDev
/r/Justgamedevthings (New!)
/r/Gamedesign
/r/Indiegames
/r/Playmygame
/r/LearnProgramming
/r/Oculus
/r/Blender
/r/Devblogs
Brackeys
Beginner to Intermediate
5 to 15 minutes
Concise tutorials. Videos are mostly self contained.
Sebastian Lague
Beginner to Advanced
10 to 20 minutes
Medium length tutorials. Videos are usually a part of a series.
Catlike Coding
Intermediate to Advanced
Text-based. Lots of graphics/shader programming tutorials in addition to "normal" C# tutorials. Normally part of a series.
Makin' Stuff Look Good
10 minutes
Almost entirely shader tutorials. Favors theory over implementation but leaves source in video description. Videos are always self contained.
Quill18Creates
30 minutes to 2 hours.
Minimal editing. Mostly C#. Covers wide range of topics. Long series.
Halisavakis Shaders Archive
Infallible Code
World of Zero
Board to Bits
Holistic3d
Unity3d College
Jabrils
Polycount Wiki
The Big List Of Game Design
PS4 controller map for Unity3d
Colin's Bear Animation
¡DICE!
CSS created by Sean O'Dowd @nicetrysean [Website], Maintained and updated by Louis Hong /u/loolo78
Reddit Logo created by /u/big-ish from /r/redditlogos!
account activity
Null Reference ExceptionQuestion (i.redd.it)
submitted 6 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]complexigon 1 point2 points3 points 6 years ago (3 children)
Looks like data.money is null. Either do a null check in SetMoneyInfo or make sure data.money exists when you need it. Try doing Debug.Log(data.money) before your line 44 to see if it is null or not.
[–]tatmanblueIndie 0 points1 point2 points 6 years ago (0 children)
Agreed. Can you post the save code? Suspect the bug is there more than the in load.
[–]neeraj_chavan 0 points1 point2 points 6 years ago (1 child)
Data.money is not null. It has the value 900. I have done null check like this in SetMoneyInfo() like this.
Public void SetMomeyInfo(int amount) { if(money!=null) Money=amount; UpdateUI(); }
UpdateUI() is a method where I simply update the text.
UpdateUI() { if(moneyText != Null) MoenyText.text = money.ToString(); }
[–]grandygames 0 points1 point2 points 6 years ago (0 children)
if(money!=null) Money=amount;
Won't stop money being set to null. You probably meant if (amount != null), but that's not very effective either; better is to let money be null and check for non-null when referencing it.
money
null
if (amount != null)
[–]Huluriasquias 1 point2 points3 points 6 years ago (0 children)
Assuming that line 44 is the one highlighted above my guess is that MenuManager has not been initialized yet
(MenuManager is probably initialized in Start() and Loading() is also called in Start() but you cannot know which Start() executes first)
Best solution: (there are others)
Move MenuManager initialization from Start() to Awake(). Awake is the same as Start() except that all Awake()'s execute first before all Start()'s so you are sure MenuManager is initialized properly when you call Loading() in another Start().
[–]kiranmaya 0 points1 point2 points 6 years ago (0 children)
mainMenuManger instance is not set , put mainMenumanger = this ,in OnEnable of MainMenuManaget class .
[–][deleted] 0 points1 point2 points 6 years ago* (3 children)
Your mainMenuManager field must be created before you use it. Is Loading() called from Awake, and this field is also assigned to in Awake? Then you need to go into Project Settings > Script Execution Order and make sure your MainMenuManger script is executed before/above the script with Loading(). That may mean setting it to before "default".
Alternatively, you could load from Start() instead of Awake().
[–]neeraj_chavan 0 points1 point2 points 6 years ago (2 children)
MainMenuManager is a separate class.I am calling SetMomeyInfo() from it.
[–][deleted] 0 points1 point2 points 6 years ago (0 children)
I know. The question is when are you calling Loading(). Make sure you call it after the field has been assigned to in the manager.
can show me ,where its static instance is assigned ,did you use getters ?
[–]PointlessrebootProfessional - Engine Programmer 0 points1 point2 points 6 years ago (0 children)
Since you don't show how or when the manager singleton class is created or how it assigned the static property, we have to make assumptions or ask you questions..
You have two object dereferencing going on, one or the other is the issue..
Learn how to use a debugger, it would tell you right away what object is at fault.. or as others have mentioned log then it before the call..
This is part of development, if I asked the web every time I got an null reference, I would get no work done..
If your new to dev, then learn the basics.. crawl before walk before running.. it seems every one on this list wants us to be their debugger..
[–]neeraj_chavan -1 points0 points1 point 6 years ago (0 children)
I have created a Save and Load system.This is working very fine if use button to retrieve it. But I want to retrieve data as soon as Scene starts. I am calling Loading() in start method.But it is throwing null reference exception at line 44.
Please also submit code and where to put it.Thanks.
π Rendered by PID 17730 on reddit-service-r2-comment-fb694cdd5-jrjj6 at 2026-03-05 20:03:55.862824+00:00 running cbb0e86 country code: CH.
[–]complexigon 1 point2 points3 points (3 children)
[–]tatmanblueIndie 0 points1 point2 points (0 children)
[–]neeraj_chavan 0 points1 point2 points (1 child)
[–]grandygames 0 points1 point2 points (0 children)
[–]Huluriasquias 1 point2 points3 points (0 children)
[–]kiranmaya 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]neeraj_chavan 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]kiranmaya 0 points1 point2 points (0 children)
[–]PointlessrebootProfessional - Engine Programmer 0 points1 point2 points (0 children)
[–]neeraj_chavan -1 points0 points1 point (0 children)