Can anyone reason why during implementing this lecture I started getting these wild errors shortly after connecting the VFX prefab to the Block prefabs? The game won’t even work now.
The ball will launch and collide and I get the VFX effect but the blocks won’t destroy now and i’m getting a “NullRefferenceException: Object reference not set to an instance of an object” message every time I hit a block.
Seems like the issue is the blocks won’t trigger to break all of a sudden… but here is my code for block breaking and it worked fine a few minutes ago…? I am confused here.
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.
NullReferenceException means that a reference (“link”) to an instance is missing. Double click on the error message to see to which line in your code it is referring. If you exposed a field in the Inspector, make sure that it’s not empty.
Hope this helps
See also;
- Forum User Guides : How to apply code formatting within your post
Thank you Nina, I apologize for my formatting. I wasn’t aware of the recommended syntax for showing code.
I appreciate the tip on double clicking the error, I didn’t know it would take me to the code. I was able to link up the required field in the inspector and now all seems to be working again for the moment lol.
Best,
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.