Unity Console Compiler Errors
Updated list of the most common compiler errors developers experience. A short list is a good list. :)
Reminder - Keep Daily Backups
When working on a strategy game with a kit as big as the Complete Kit - always keep a working daily backup! Save yourself the trouble of rolling-back changes and losing work.
Error CS0246 - UILabel, UIProgressBar, UI etc.
Assets/Scripts/Buildings/BuildingCreator.cs(17,16):
Error CS0246: The type or namespace name 'UILabel' could not be found. Are you missing a using directive or an assembly reference?
Assets/Scripts/Stats.cs(14,16):
Error CS0246: The type or namespace name 'UIProgressBar' could not be found. Are you missing a using directive or an assembly reference?
Troubleshooting:
-
UILabel errors mean something is wrong with your import of NGUI or 2D Toolkit. Check that you're using the most recent paid version of NGUI (version 3.6.8 or above). The free version of NGUI (version 2.7.0) is outdated and will give you these UILabel errors. Read the installation section again.
-
If you're running the most recent paid version of NGUI, as per NGUI's team instructions start with a fresh copy of the Starter Kit and import NGUI in a new empty scene, not directly in Game scene (throws a few internal NGUI errors if you import into the Game.unity scene).
-
Safer to apply this to 2DToolKit as well, and import 2D Toolkit into a new empty scene of a fresh starter kit copy as well.
All Other Errors
Our kits includes over 100 Unity C# scripts controlling every aspect of the gameplay. It's possible that during your use you changed a setting. If you've encountered an error code we haven't listed here, please follow these steps:
Troubleshooting:
First, download a fresh copy of your kit, import both NGUI and 2D Toolkit again. Run the Game.unity scene to test that the original copy works as expected in your development environment. Does the fresh copy of the kit work?
Yes, it runs: - If the fresh copy runs, retrace the changes you've made recently. Replace the scripts you've edited with original copies, one-by-one to identify the specific issue. Tip: We recommend saving daily backups of the source code so you have a recent copy of each script to cross-check.
No, it doesn't run: - If this doesn't work, update your copies of NGUI and 2D Toolkit to the most recent paid asset versions and follow the Getting Started page in the documentation. If this continues to not work, please send a screenshot of your setup and the specific error codes you're receiving to help (at) citybuildingkit.com
Still Having Problems?
The catch-all fix for most errors we've come across is to download the original kit again and replace the scripts you've edited one-by-one to troubleshoot where the exact problem is.
To prevent future problems, always keep a backup of every script - daily backups preferably - so that if a problem occurs, you can revert to the most recent save.
Updated less than a minute ago