This has been a difficult week, a week I took off work to A) recover from the game jam and B) make an attempt at ploughing through and getting loads of work done on Shh,Zombies (B being the main reason). Unfortunately, I didn’t make as much progress as I’d hoped, but progress has been made!
I started the week of by doing small bits, for example, finishing implementing the UI and fixing some bugs that arose from the functionality of it, and tweaked some of the level layouts. I realised this was just polishing, that could be left until much later, so I changed my ‘To Do’ list. The list still has a few “polishing” bits on, but bits I believed would be quick to do and wanted to get out of the way.
So far so good, now time to start on new levels, actual content for Shh,Zombies! This was something I thought would be fairly quick to do, and building them is — balancing them so the Day/ Night solutions are different, challenging and enjoyable is where most of the time is going. Tuesday night, time to do a build and show off the new content!
The zombie head collectables are broken! The player now just hits them like they’re a wall, but I haven’t changed anything?! What’s going on! It works fine in the editor, but not in the build? I spent probably two hours trying to work out what was going on, I googled: http://bit.ly/QjQAPo , I posted on the Unity forum: https://t.co/73AmGvG3e4 , I tweeted:
— Enigma 23 (@en9g131) April 16, 2014
From both of my accounts:
— Peter Law (@carwashh) April 16, 2014
I was convinced my code was fine -
It worked perfectly in previous builds.
It worked perfectly in the editor with the current build.
It, now, did not work at all if I built it to the webplayer or an exe.
Any help at this point, was fruitless, and just concentrated on my code — it wasn’t a code problem, stop looking at my code and trying to “fix” that! At this point I didn’t have a clue where to being looking, so couldn’t fix it without blindly poking around — at things I knew wouldn’t make a difference — a frustrating situation to be in, although I did appreciate the help. The batteries in my keyboard ran out, I gave up, went to bed.
Instead of wasting any more time on this, I just continued with creating move levels. Whilst discussing my progress with a friend, Mr. Wesson, on Skype I came up with a new idea, potholes! So I rushed off to make the first level (the tutorial level) with a pothole — issue number 2 arose! The zombies, ignored the Y‑axis and just floated across the potholes.
This happened because I was using the code below to move and rotate the enemies.
I knew what I had to do here though, had to change to using the rigidbody to move and rotate instead, so now I’m using this code (with other bits of code changed). To my surprise, after much fiddling, this worked AND improved the movement, no bouncing around now!
This brought back an old issue, that I had forgotten about (it only happens when my setup is rigidbody + animation), the collider doesn’t stay with the enemy mesh properly. This issue is still a work in progress to fix, for now I just have the animator disabled.
Thursday was a long, hard day, which came together by the end. I had the enemies moving properly and falling down potholes, I had a temporary solution to the collider not sticking with the enemy mesh and by the end of the day I had fixed the collision issue on the zombie heads!
I must thank a user on the Unity Answers website for helping me, http://answers.unity3d.com/questions/688926/collisions-not-working-when-game-built-but-works‑f.html , I’d almost given up hope, but he lead me to salvation! The place where I could work out what was going on. The problem was that the materials for the detonator explosion had lost the connection to the detonator. The Unity editor added them automatically when instantiating the object, whereas the build wouldn’t. Re-adding these to the prefab fixed the problem.
Doing a development build, which I hadn’t thought to do and didn’t know what it did until now, gave me the answer. It was clear from the log what was happening. Such a relief!
Something else good came from this, I realised and changed my code for the zombie head. Hopefully now it’s more optimised(?), probably doesn’t give a big gain in anything though. The code changed from this:
Now back to work making more levels!