Friday, December 5, 2014

Install and Maintain Unity 4.6 and Unity 5.0

OS: Mac 10.10 (works on 10.9 and 10.8 too)
Problem: Unity 4.6 and 5.0 installer wants to install into the /Applications "Unity" folder.

I've found it's super easy to keep both my Unity 4.6 and my Unity 5.0 both installed AND updated by understanding the install process and setting up your folders.

Current naming:
Unity 4.6.p1 is named "Unity 4.6"
Unity 5.0.b14 is named "Unity 5.0"


I also replace the Unity 5 beta icons to when they are running and on my dock I can easily tell which version is which.



To maintain: Download the updated Unity and run the installer. Once complete, rename your original folder (like "Unity 5.0.b13) and then rename the "Unity" folder to match the version you downloaded.

Thursday, December 4, 2014

Unity Related Sites

The Best Websites, YouTubers and Forums for Unity Developers

It’s no secret that Unity has become the dominant platform when it comes to game development, powering thousands of titles released on the App Store and Google Play. In fact, over 50% of the top grossing mobile games in the US were made with Unity and Unity-powered games are enjoyed by over 600 million gamers, according to the company’s own stats.
The internet is therefore awash with tutorials, video guides, forums and paid courses to help budding Unity developers and seasoned pros looking to expand their knowledge. But rather than scour the web for the best content yourself, why not let us do the hardwork for you? Below you’ll find a round-up of the best websites, YouTube channels and community sites for Unity development. These resources should help both beginners and experienced developers . If you think we’ve missed anything get in touch and let us know.

Unity YouTube Channels

Are you a visual learner? Then check out these YouTube channels for hours upon hours of Unity development tutorials.
Unity (Official) – The official YouTube channel for Unity. Features a mix of content, including a few tutorials, developer interviews and game previews.
Pushy Pixels – Great collection of Unity tutorials under the Cooking with Unity brand. Regularly updated and loads of content.
Quill18Creates – Another great Unity channel on YouTube. There’s loads of stuff covered, and regular updates. Mainly focused on Unity 3D.
UnityKnowHow – Not been updated in a while but there’s still lots of good content here for beginners.
Brackeys – Covers game development in general but has a number of video series on Unity development. Well worth subscribing to.
TornadoTwins – YouTube channel for Dutch game developers TornadoTwins. Unity tutorials mixed in with dubstep tutorials. Worth checking out.
3DBuzz – Quite a lot of videos on Unity 2D development and 2D development in general. Regularly updated too.
BrentM (2D simple) – Not much content on this channel, but there is a nice series on creating a simple 2D game in Unity for beginners.
How to Build Games – Only a few videos, but potentially useful if you’re starting out in 2D Unity development.
Hatzynx – Not been updated for a while but lots of Unity 2D stuff here.
Video tutorial from the PushPixels channel

Unity Websites and Blogs

Here you’ll find tutorials, tips, blogs and sites that offer structured and paid courses for Unity developers.
Learn with Unity (official) – The official Unity learning hub. This should be your first stop for tutorials, communities, live training and all kinds of cool resources.
Unity Wiki – The Wiki for Unity. Lots links to tutorials, projects, tips and tools.
Ray Wenderlich Tutorials – Popular site for a range of development tutorials. Great series on using Unity 3D for iOS. Scroll down the page to find it.
Learn Unity 2D – As the name suggest, website that’s focused on 2D development. Covers video tutorials and has a blog that posts notable 2D Unity games.
Unity3D Student – Hasn’t been updated in quite a while, but there’s still a wealth of video tutorials and structured lessons.
Catlike Coding – Catlike Coding’s series of Unity tutorials for both beginner developers and more experienced devs.
WalkerBoyStudio – Unity coding course from developers Walker Boys Studios. Provides a structured course to follow and a certificate for completion.
Digital Tutors – Paid development tutorial platform. Prices start from $29 per month for around 2000 courses.
CGcookie – The Unity section of the CGCookie network of paid tutorial sites. Expect to pay around $14 per course, or you can sign-up for $18 per month.
50 Tips for Working with Unity – Round-up of quick and dirty tips from Dev Mag. Lots of other good content on the website too.
Burgzergarcade – A collection of great tutorials here, covering GUI basics, 3D menus, and lots more.
Design3 – Paid tutorials offered by developers Design3. There’s also a few free lessons you can check out.
A live training video from the official Unity website

Unity Forums and Communities

Sometimes you’ll have a question that isn’t covered in a generic guide, so check out these forums and communities where you can get expert advice, read-up on the latest Unity news and vent all your Unity-related frustrations.
Unity Forum (official) – The official Unity forums. Loads of subfolders here broken down into graphics, multiplayer, and physics.
Unity Answers – Official answers site from Unity. Ask all your Unity questions here.
/r/Unity – The general sub-reddit for Unity. However, it’s not that active. You’re better off on Unity3D or Unity2D subreddits below.
/r/Unity3D – The sub-reddit for Unity3D development. Ask questions, post news and upvote away.
/r/Unity2D – Same as above but for Unity 2D development.
/r/Unity_Tutorials – Looking for the latest tutorials? Check out this sub-reddit. Regular updates.
Unity Ninja – Unity-focused forum. Relatively active. There’s forums to show off your projects and seek team members.
ArmedUnity – Unity forum featuring community blogs and projects, as well as showcase, help and other subfolders.
AutoDesk Unity Forum – The Autodesk sub-forum that focuses on Scaleform/Unity development.
Brackeys Forum – Forum for the Brackeys tutorial site. Very active but not purely Unity-focused.
Looking for more mobile game resources? Check out our big list of engines, tools, frameworks and tutorials right here.

Wednesday, November 19, 2014

Unity Full Project Export

I tweak, patch and update many of the assets I purchase / download from the Asset Store. When creating packages (exports) I struggled to create an export that included the "Project Settings" folder where nifty things like the TagManager, LayersManager and InputManager all reside. Sure the old method of zipping up the folder and placing the .zip file inside the Assets folder would work but was extremely clunky.

A quick search on the Unity Answers section led me to an Editor based(1) script that would create a full project export; including the Settings folder. Sweet!

Here is the script, in all its glory!

using UnityEditor;
using UnityEngine;

public class FullExport : MonoBehaviour {


    [MenuItem("Tools/Full Export")]
    private static void NewMenuOption()
    {
        string fileName = "FullProject_Export.unitypackage";
        AssetDatabase.ExportPackage("Assets"fileNameExportPackageOptions.Interactive | ExportPackageOptions.Recurse | ExportPackageOptions.IncludeLibraryAssets|ExportPackageOptions.IncludeDependencies);
        Debug.Log(fileName + " is located in this projects root folder");
    }
}
To "run" the script, after installing just look at the menubar for "Tools" and then choose "Full Export".



You can download the script already set inside an "Editor" folder which is inside an "_Exporter" folder.


(1) Editor scripts MUST be located inside a folder called "Editor". The folder can be a subfolder AND you can have as many as you want(2) .
(2) Just like the "Resources" folder, they can be scattered through out your project and all will be merged when building your app.

Wednesday, November 12, 2014

Unity 3D ErrorManager v1.1 (text logging)

Edit: Use this with Unity 4.6 and newer; for Unity 4.5 and older, please see THIS post

While I've named it ErrorManager; it could just as easily have been named TextLogManager because it can be use for so much more than just errors.



Here's the top part of the C# file - see below for download link
/// <summary>
/// ErrorLogManager 
///     - Primaryused to log errors to text file
/// 
/// Created byGregory Meach
/// DateNovember 122014
/// Version1.1 (Updated for Unity 4.6)
/// 
/// LicenseDo what you wantno credit necessary
/// LiabilityNone whatsoever.
/// 
/// Example: (called from ANY other class)    
///     ErrorLogManager.sharedManager.UpdateErrorLog("fakeMethod","not found",ErrorLogManager.sharedManager.GetErrorDate());
/// Note:
///     GetErrorDate() helper returns "nowas a string
///
/// </summary>

public class ErrorLogManager : MonoBehaviour {
    
    #region ErrorLog
    [Serializable]
    public class ErrorData {
        public string method;
        public string error;
        public string dateString;
    }
    public List<ErrorDataErrorList = new List<ErrorData>();
    private string currentLogName = string.Empty;
    private string logInitText = string.Empty;
    private bool isFirstSave = true;

    // Set this to whatever name you want to use
    private string errorLogName = "Game_ErrorLog";

    // Set this to the maximum log entries before they are auto-saved
    private int maxLogEntriesBeforeSave = 30;

    // Set this to TRUE to overwrite the log file on startup
    private bool clearErrorLogOnStartup = false;

    // Set this to FALSE to overwrite the log file on startup
    private bool useTimeStampInFileName = true;

    // Helper methods
    public string GetErrorDate() { return System.DateTime.Now.ToString("s"); }
    public string GetSavedDataPath() { return (Application.persistentDataPath + Path.DirectorySeparatorChar); }
    public string GetFileDate() { 
        string dateString = System.DateTime.Now.ToString("d"); 
        dateString = dateString.Replace("/",".");
        return dateString;
    }

    public void UpdateErrorLog(string callingMethodstring errorMsgstring errorDate) {
        ErrorData newError = new ErrorData();
        newError.method = callingMethod;
        newError.error = errorMsg;
        newError.dateString = errorDate;
        ErrorList.Add(newError);
        if (ErrorList.Count > maxLogEntriesBeforeSave)
            FlushErrorLog();
    }

Here's the package link: ErrorManager_v1.1.unitypackage

Tuesday, October 28, 2014

Icon Set Creator v3.0 (iOS 8)


Previous post here: iOS Icon set Creator

So here's what the updated Automator workflow does:
Asks for your base (1024x1024) icon image then duplicates it, scales it and renames it, rinse and repeat until all twelve  (12) icons are created.

Notes: You can use the 1024 size icon to upload to iTunes Connect. Icon names have been revised to match Xcode 6 for easy drag and drop.

File listing:
iPad76@2x.png
iPad76.png
iPad40@2x.png
iPad40.png
iPad29@2x.png
iPad29.png
iPhone40@2x.png

iPhone60@2x.png
iPhone29@2x.png
iPhone60@3x.png
iPhone40@3x.png
iPhone29@3x.png


The workflow WILL NOT overwrite any existing files so make sure to put your base image in its own folder.

1000 words..... (very, very old screenshots...)

Test folder with 1024 icon (can be named whatever you want)

Launch Automator app and click the Run button...
Browse to and select your 1024 icon file
This is where the "magic" happens (lol!)

Completed folder with shiny new icons, yeah!
(Very old image)

In the zip file is a second Automator "application" named "Create iOS Iconset Droplet iOS8". You don't run this application you simply drop your 1024 icon onto it and the magic happens... sweet right? I know... :-]

To use the droplet, just drag the droplet to your Dock. Now when you need a set of icons, place your master image in a folder, then drag it on top of the droplet and give it about 3 seconds and its done. This has a permanent home in my Dock.


Download link: CLICK ME

Monday, October 13, 2014

iOS 8 & iTunes Connect

Quick post:

Using Xcode v6.0.1 when you submit a second update you MUST update the build number otherwise you'll get an error about "Build xxx" already exists.

Friday, September 12, 2014

Xcode 6, Simulator & iOS 8

Um yeah so what's up with the "features" in Xcode 6?

1: The "new" Devices window only show about 10-12 lines of the device log - um yeah, thanks Apple, that's helpful! NOT.



2: Being familiar with shortcut key combos; we all know that {CMD} + {SHIFT} + {K} will Klean the build (see what I did there) but now in the simulator there's the SAME combination that will DISABLE the on-screen keyboard. So, make sure your have Xcode selected before you press that key combo! Yeah I futzed around debugging that non-existing problem for about 30 minutes! ARG

 



3: UIActionSheet has now gone the way of UIAlertView; meaning you can no longer sub-class it and add subviews. Handy, right? Well github to the rescue; just drop this bad boy in and off you go!
LINK

Well that's it for now, back to cleaning up my apps for iOS 8!


Tuesday, June 24, 2014

Unity 3D ErrorManager (text logging)

Edit: Use this with Unity 4.5.x and older; for Unity 4.6 and up, please see THIS update

While I've named it ErrorManager; it could just as easily have been named TextLogManager because it can be use for so much more than just errors.

Here's the top part of the C# file - see below for download link
/// <summary>
/// ErrorLogManager 
///     - Primaryused to log errors to text file
/// 
/// Created byGregory Meach
/// DateJune 232014
/// Version1.0 (initial release)
/// 
/// LicenseDo what you wantno credit necessary
/// LiabilityNone whatsoever.
/// 
/// Example: (called from ANY other class)    
///     ErrorLogManager.sharedManager.UpdateErrorLog("fakeMethod","not found",ErrorLogManager.sharedManager.GetErrorDate());
/// Note:
///     GetErrorDate() helper returns "nowas a string
///
/// </summary>

public class ErrorLogManager : MonoBehaviour {
    
    #region ErrorLog
    [Serializable]
    public class ErrorData {
        public string method;
        public string error;
        public string dateString;
    }
    public List<ErrorDataErrorList = new List<ErrorData>();
    private string currentLogName = string.Empty;
    private string logInitText = string.Empty;
    private bool isFirstSave = true;

    // Set this to whatever name you want to use
    private string errorLogName = "Game_ErrorLog";

    // Set this to the maximum log entries before they are auto-saved
    private int maxLogEntriesBeforeSave = 30;

    // Set this to TRUE to overwrite the log file on startup
    private bool clearErrorLogOnStartup = false;

    // Set this to FALSE to overwrite the log file on startup
    private bool useTimeStampInFileName = true;

    // Helper methods
    public string GetErrorDate() { return System.DateTime.Now.ToString("s"); }
    public string GetSavedDataPath() { return (Application.persistentDataPath + Path.DirectorySeparatorChar); }
    public string GetFileDate() { 
        string dateString = System.DateTime.Now.ToString("d"); 
        dateString = dateString.Replace("/",".");
        return dateString;
    }

    public void UpdateErrorLog(string callingMethodstring errorMsgstring errorDate) {
        ErrorData newError = new ErrorData();
        newError.method = callingMethod;
        newError.error = errorMsg;
        newError.dateString = errorDate;
        ErrorList.Add(newError);
        if (ErrorList.Count > maxLogEntriesBeforeSave)
            FlushErrorLog();
    }

Here's the package link: ErrorManager_v1.0.unitypackage

Tuesday, February 4, 2014

Unity3d and "strings"

I've been using the Unity Asset Store a lot and have downloaded quite a lot of free assets and purchased my fair share as well.

One thing I see a lot in many of the C# scripts (probably in Javasc, oops  UnityScript too) is the repeated use of using plain old STRINGS in critical, e.g. game breaking methods and processes.

I mean we use strings all of the place and it seems like Unity / C# is no exception especially since you define and use both TAGS and LAYERS and they are of course strings!

Here's my GOLDEN RULE for STRINGS:
If I have to type the contents of a string (like "com.meachware.levelOneLeaderboard") more than ONCE; I must create a constant for it. <- period!


The kicker is the simple fix in C# is this:

using UnityEngine;
using System.Collections;

namespace com.ootii.Messages {
    public class Type {

        // A list of Message types.
        public const string all = "EVERYONE";
        public const string filter = "FILTER";
        public const string target = "TARGET";

    }
}
Note: This example is taken directly from the awesome Unity Dispatcher asset I just purchased and even he didn't use constants (that's the reason for the "namespace").

Yup, create a new class and list out all your string constants. Then in ANY other class when you need to access them, instead of typing "FILTER" you simply use "Type.filter" (without the quotes).

Oh AND you get, for FREE type-ahead / autocorrect! How sweet is that!

Now I have not done any benchmarks to see if you have say 1200 const string entries it impacts memory / performance but I gotta believe the benefits outweigh any impact.

PS Full credit for this concept (at least where I learned it from) is the Unity Learn series / Stealth project. Here's the link where they talk about Tag Management.