[Unity3D] #DEVELOPMENT_BUILD not working in PreBuild Script IPreprocessBuildWithReport
I was trying to get some logic to work in a PreBuild script whether the build is a development build or not using the define symbol #DEVELOPMENT_BUILD. It works in regular scripts, but apparently it doesn't work for PreBuild scripts because the symbol won't be defined until the build actually starts. So the #DEVELOPMENT_BUILD never actually hits even though you have "Development Build" checked in the Build Settings.
To check whether or not your build is a development build use:
var isDev = (report.summary.options & BuildOptions.Development) != 0;
In the PreBuild script it would look like this:
public void OnPreprocessBuild(BuildReport report) { var isDev = (report.summary.options & BuildOptions.Development) != 0; if (isDev) { // Is development build } else { // Normal build } }
Source: https://qiita.com/Clpsplug/items/c34e8f596e54444623ba
[FIX] Unity3D Cloud Build Missing Sprites
I was making a build the other day using Cloud Build, but some of the sprites were missing for some reason. Everything looked fine on a local build though.
Turns out I had the sprites in a folder called "Library" in my Unity Project and Cloud Build ignores or strips out content from that folder. The sprites showed up again in the cloud build after renaming the folder.
[How] Bypass Unity3D's "Hold on" Import on Launch
Sometimes it takes forever for Unity to launch. Especially when you have a lot or large assets. For some of our projects it could take hours for Unity to actually launch the editor. It's super annoying and you can't do anything else in the meantime. But there is a way to skip all that in the newer versions of Unity.
If you're having this problem, start a new project with a particular Unity version so you can actually get into the editor. Then go to Edit > Preferences > General and UNCHECK "Compress Assets on Import". Now close the project and open your actual project and it should launch way faster!
[HOW] Find Old Firebase SDK Versions for Unity3D
The SDK link on the Getting Started with Firebase page automatically downloads the latest Firebase SDK. Quite annoying if you're looking for an older version if you want to re-import an older SDK for your project for example. Luckily there's a way to download the older versions. Just enter the version number that you want in this link https://dl.google.com/firebase/sdk/unity/firebase_unity_sdk_{Version number}.zip.
For example, if you're looking for version 6.0.0, the download link would be https://dl.google.com/firebase/sdk/unity/firebase_unity_sdk_6.0.0.zip. That's it!
Source: https://stackoverflow.com/questions/49921164/old-versions-of-firebase-for-unity-firebase-sdk-4-5-0
[FIX] Unity3D - Moving Files Failed Error When Making Build
I've been playing around with some Unity3D plugins lately. Trying out different ones to see what works and what doesn't for my Infinite Meow game. At some point, I was trying out the Google Play Game Services plugin and got this error message when I was trying to make an Android build which prevented me from finishing the build.Read more
[How] Parse.com Get Data as Multidimensional List in Unity3D C#
I recently found that you're able to save multidimensional data to Parse. Saving the data wasn't a problem though, but getting it back from a ParseObject took me a while before I finally got it working.Read more
[FIX] Unity3D - Android - Unable to List Target Platforms
A few months ago I was trying to create an Android build for one of my Unity3D projects which used to be primarily for iOS. When trying to create a build, Unity showed this error:
Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
[FIX] Unity3D - Android Keyboard White Text on White Background
The Android Keyboard text appears to be white on a white background for some reason (at least in Unity 5.5.1f1 and below) when testing on an Android device. So there's no way for the user to tell what the current input text is unless they highlight it. Not sure if it's an actual bug on Unity's end or if there's a styling conflict caused by multiple Android manifests. Luckily, there's a quick way to fix this.Read more
[Unity3D] Copy to Clipboard Script for iOS & Android
I was looking for a way to copy a piece of text to the clipboard on iOS and Android devices the other day. There are ways to do it for Windows and Mac computers, but getting that to work for mobile devices seemed a bit trickier. There were some solutions on the Unity3D Community forums, but they were always either for iOS OR Android and required additional extra steps to make it actually work. Luckily, I found this handy script by Wataru Sanuki which handles cross platform copy to clipboard in a single class.Read more
Useful Unity3D Stuff
I work quite extensively with Unity3D and over these past few years I've come across a ton of problems. Usually I managed to find a solution for them, but I don't always keep a record of those solutions. If I do, it ends up being a bookmark or a note somewhere. So I decided to make a post to keep track of useful stuff for Unity3D. I can finally clean up my mess! And who knows. It might help other people as well.
Unity3D Useful Tools, Scripts, Shaders
- Invert/Reverse Mask Shader
- Create Bitmap Fonts for Unity3D
- Open Source Unity3D UI Extensions. A bunch of scripts with more advanced and super useful UI features and effects for your Unity projects, such as Accordion, Scroll Snap, Re-orderable Lists, Curved Text, etc. Best of all... it's FREE!
- Copy to Clipboard Script for iOS & Android
Unity3D Fixes and Workarounds for Bugs and Other Wacky Things
- Allow Animator Triggering Same State
- Unity3D 4.5 Hierarchy Sorting By Name
- Black Screen on iOS Devices
- Animation Must be marked as Legacy Warning
- Canvas Component - Override Sorting disables Blocks Raycasts
- Rigidbody 2D has velocity but isn't moving after Unity 5 upgrade
- iTween.MoveTo is tweening the button to the wrong position in the Rect Transform position
- More advanced ScrollRect usage to add and expand items
- Android Keyboard White Text on White Background
- Android - Unable to List Target Platforms
Unity3D Features & C# Explanations
Articles and links that explain how certain features and coding principles actually work.
- SendMessage and BroadcastMessage
- Why float comparison doesn't work
- Designing UI for Multiple Resolutions