- Home /
Collisions not working when game built, but works fine in the editor
Hi,
I'm making a puzzle game, where the gamer has to get the player safely from the start to the exit by placing waypoints and then pressing 'Go'. On the level there are zombie heads (ie: stars) to collect, which when the player touches them there's a particle effect and the game object is destroyed.
This worked perfectly in previous builds.
This works perfectly in the editor with the current build.
This, now, does not work at all if I build it to the webplayer or an exe.
To see the problem, look here: http://enigma23.co.uk/Unity/sz/prototype/2014.04.16_PrototypeBuild11.html
Click 'Play'.
Click 'Normal'.
Select Level 1.
Put down a single waypoint on the exit (left mouse click on the exit).
Press 'Go'.
Player hits the zombie head as though it's a wall, instead of collecting it.
Recent Changes
1- I activated the 30 day trial of Unity Pro yesterday (needed it for another project), up until then I was (and will be again) using Unity free.
2- I've swapped from Monodevelop to Visual Studio 2013 for my IDE, and get warnings about line endings being different between Windows/ UNIX/ Mac (I sometimes dev on a Mac at work).
Fix Attempts
1- I've gone through all of my scripts (not any plugin scripts), to stop the inconsistent line endings warning from happening.
2- Updated to the latest version of Unity (4.3.4f1).
3- Rebooted.
4- Tried to build on a Mac.
Questions
I haven't a clue where to start looking to fix this issue, as up until a few days aog everything was fine - and I haven't touched this area since implementing it months ago.
1- How do I go back to Unity free now? (so I don't have to wait for pro to expire)
2- What's the difference between the editor and the web/ exe builds?
3- Why would the collisions work ok in one and not the others?
4- How do I even go about fixing this?
I'm back on Unity Free now, and that made no difference (assumed this would be the case anyway).
I have the same issue, Upon creating the build the tag for the pickups (doing the tute for roll a ball) seem to disappear. Developer mode build tells me these tags are not assigned, but in unity they are. Is there a way to fix?
If you're using prefabs, make sure your prefabs have their tags saved to them properly.
Answer by andrew_196 · Apr 17, 2014 at 06:48 PM
have you tried to launch/build as a development build and run a:
Debug.Log("Debug here");
to see if it is the function or the trigger?
Just moving this (old) comment here under the answer.. hopefully stop new people replying.
I hadn't thought about using a development build, nor did I really know what it does.
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. Thank you so much!
Some additional information, which I had to go searching for as I didn't know what I was doing:
The console output is dumped to the file _Data/output_log.txt
Answer by Shinugami · Apr 28, 2015 at 03:55 PM
I also was unable to use the mouse during build version of my game. In the editor it worked fine. What was happening was that I had Unity crash at one stage. I've had this problem before so I was aware of how to fix it. If I look at the 'output_log.txt' in the build folder when using debug mode for the build, it says that some tags do not exist.
For example: "UnityException: Tag: Food is not defined."
When unity crashes, for some reason it wipes the tag list. You can select the drop down menu and they are all there HOWEVER if you do 'add new tag' then the truth is revealed and here we can see that the tag list is actually empty. I'd say this is a unity bug as it shows the tags when you casually use the drop down menu for 'add tag to object' however when you go to actually add a new tag to the tag list there are NO tags at all.
I restored those tags and re-assigned them to the correct objects. This fixed the issue and the mouse functioned in the build mode as expected.
I feel a mighty need to upvote, and add to this. Even as of January 2019, tags can still present a problem like this. If you have removed tags or Unity crashed or anything, be SURE to close and reload Unity before building, or it will have similarly unexpected behavior. Thanks, and sorry for the necro!
Answer by maftkd · Jan 09, 2018 at 11:10 PM
I had a similar issue with triggers being detected fine in unity editor, but triggers not being detected in final builds.
I understand this thread is old, but perhaps one person may come across this in the future. And that one person may have the same peculiar setup as I did, and therefore this comment may be beneficial.
Ok so. My deal was I had my trigger objects as children of a parent container. That parent container just so happened to be Canvas / GUI container. Unity did not like this. It said hey, we know you are used to your triggers being right here, but when you build it, we are going to place them elsewhere since this seems like it's just part of your GUI.
My fix: Remove the children, place them under a plane ol' empty game object, and adjust the connections between the objects accordingly.
Answer by Carwashh · Apr 17, 2014 at 08:23 PM
I hadn't thought about using a development build, nor did I really know what it does.
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. Thank you so much!
Some additional information, which I had to go searching for as I didn't know what I was doing:
The console output is dumped to the file _Data/output_log.txt
that is great glad I could help, I posted it as an answer I was wondering if I could get market as correct.
Answer by Amjad_Mohamed · Mar 01, 2020 at 01:58 PM
Hey from the future. I had the same problem with my trigger and found out that the thing that caused my problem was that I changed my collider tag and deleted the old one, but that caused Unity for some reason to not detect the new one after the build. To fix that I had to close Unity and open it again to get the deleted tag out of the list and after that I built it again aaand it worked :).