Hello, it’s my first time building a project to try it out and i’m facing some problems.
The game is a simple brickbreaker clone that is currently working fine while in the editor.
The problems starts when i build the game.
The things that are not working are the block that are not showing up at all. Those are instantiated everytime a new level is being built.
And also, the “OffsideZone” where the balls collides and disappear so the player loses one life is not working, the ball disappears but nothing happens, it’s like the scripts are not running or something.
The ball is also instantiated at the beginning of the game and it’s working fine.
So, your post contains a few questions. Let us break them up.
“Blocks are not showing up at all”
If they are supposed to be instantiated every time a new level is being built, is the code calling the instantiation being called? You can put a Debug.Log("Is this method running?"); inside that method and check in the console if you can see the log.
“Collision with the OffsideZone causes the ball to disappear, but does not cause the player to lose one life”
Here you could actually do a similar check. Place a Debug.Log into the method to see if it is running or not.
If the issues are still there, I would need some more information in order to help you. Could you also post the code for these two systems? It will be a lot easier to then pinpoint the issues.
Hey, thanks for your time. I found out that you could attach a debugger to the build and that helped me a lot. The issue with the blocks generation was that the files with the level information were missing. Now the OffsideZone is working fine and the prefabs are showing up. But the collision on the blocks is not being detected, i’ll try a few things and post back.
Great that you figured that out. Attaching a debugger gives a lot of good insight when tracking down an issue.
Best of luck with the bug hunt, and let us know how it goes!
Well, the problem was simple to track and fix.
When i was having the problem of prefabs not showing on screen i thought it may be because of objects being displayed behind the background, so i move the prefabs to the same layer as the ball (in front of background) but that wasn’t the issue and i forgot to turn back that change and because of that, when i fixed the problem with the creation of the prefabs (blocks) the physics collision 2d matrix has disabled the layer ‘ball’ to not collide with itself (this is to prevent collision between balls when i have multiple on screen) so the ball was ignoring the blocks because of this.
In shorts, i moved the blocks to the default layer again and now it’s working.