[HELP] Game not working after Unity 5 upgrade: blocks not breaking

Hey all,

So, I’ve made it through the Block Breaker course, well, almost.

Problem: after the Unity 5 upgrade my blocks are not breaking anymore.

You can see what is going on here:
https://www.gamebucket.io/game/49cf1b39-993b-449f-92d3-3220bca94d0b

When I run the game inside Unity 5 it works just fine (except for scene 3 where blocks don’t break either, so I guess there’s gotta be a clue in there somewhere), but when I build and run it bricks do not break. Tried with WebGL and PC/Mac.

In Unity 4.7 everything is fine.

You can get my project from here:
https://github.com/kennethpino/BlockBreakerv5

I’ve been looking around for a while now and can’t find the issue.

FYI my code is not a copy of what has been done in the course. I usually try to do it on my own first and then watch the code so things turn out a bit different.

TY in advance! Let me know if you have any questions.

I haven’t gotten far enough along in the course to be of much help but, I do know there are some changes between Unity 4 and Unity 5. One of the change I believe effects Block Breaker. I know there is a post out there for the changes for Unity 5 but forgot to bookmark it otherwise I would send you the link. You can try searching for it or you might look through some of the other posts in the Block Breaker section of the forum to see if there is a similar issue and a solution posted.

This might be what you are looking for

https://community.gamedev.tv/t/solved-unity-5-brick-cs-oncollissionenter2d-isnt-being-called/10344

If you check your blocks in level 3 you will notice that they are all missing the smoke prefab reference (as are your block prefabs).

A null rerefence exception error is being generated…

…because you are trying to access a variable / property on an instance of an object that doesn’t exist;

explosion is equal to null because the GameObject.Find("Smoke") statement couldn’t find it.

This error doesn’t stop the game, but it stops the process of the block being destroyed as the next line is not run.


It looks as if you may have tried several different approaches with regards to the smoke, referencing it via the exposed public variable on your Brick class, and then also trying to use GameObject.Find() and using it in the FX_Controller prefab.

Regarding the latter, this only exists in the first scene, you haven’t added it to scene 2 or scene 3 - thus smoke can’t be found.

Hope this helps.

Privacy & Terms