You can set up Unity and be ready to build your projects for BlackBerry 10 in just a few steps. For more information about the setup process, including information about plugins and debugging, see Getting Started with BlackBerry 10 Development on the Unity website.
Download and install Unity
Visit the Unity website and download the latest version of Unity. You can download the free version or purchase the Pro version; both versions include support for BlackBerry 10. The Pro version offers additional features for large-scale projects, but you can still use the free version to create high-quality content and publish it for BlackBerry 10 and other platforms.
Make sure to download Unity 4.2 or later. Earlier versions don't include the option to build projects for BlackBerry 10 devices. This documentation is based on Unity 4.3.4.
After you download the Unity package, install it on your computer using the default installation options. Make sure that you select MonoDevelop as the default script editor; we use it later in this tutorial when we write the script for our app.
Configure and test your build settings
When the installation is complete, run Unity. If you're asked to create a Unity account, go ahead and do so.
First, you should configure your build settings so you can build and test your projects on a BlackBerry 10 device. Unity can detect and connect to your device, and you can use Unity to create and upload a debug token (which is required to test unsigned apps on the device).
You need to specify build settings for each project that you create. To test the settings that are described below, you can create or import a simple project, configure the build settings for that project, and deploy the app on your device. Here, the UnityGamepad sample app from the Core Native Community Samples repository in GitHub is used, but you can use an existing project of your own instead.
Before you begin
Make sure that you do the following:
- Enable Development Mode on your device and note the development IP address. For more information about Development Mode, see Set up your device.
- Clone or download the UnityGamepad repository from GitHub.
Register with BlackBerry and obtain signing keys
Before you start developing apps for BlackBerry 10, you need to register with BlackBerry and obtain a set of signing keys, which are sent to you by email after you register. Signing keys let you create a debug token and test your Unity apps on your device.
If you've developed apps for BlackBerry 10 using another development framework (for example, the BlackBerry 10 Native SDK), you may already have registered with BlackBerry and obtained signing keys or a BlackBerry ID token.
To register with BlackBerry:
- Visit the BlackBerry Keys Order Form.
- On the form, select the check boxes for both BlackBerry 10 development options.
- In the Personal Information section, complete the required fields.
- In the Registration PIN section, choose a PIN for your registration. Be sure to remember this PIN; you'll need it later when we configure Unity to build your project for BlackBerry 10.
- Read the BlackBerry SDK License Agreement and, if you agree, select the I have read and agree to the BlackBerry SDK License Agreement check box.
- Click Submit.
Your signing keys are sent to the email address that you specified and typically arrive within an hour. When you receive your signing keys, save the .csj file attachments to a location on your computer.
Import the UnityGamepad sample project
If you're starting Unity for the first
time, you're shown a dialog box that asks you to open an existing project or create a
new one. If this dialog box doesn't appear, on the File menu,
click New Project. For this tutorial, we can use the default
project creation options; we don't need to select any .unityPackage files from this list
and we can leave the Setup defaults for field set to
Select a location for the project and name the project Gamepad (as shown in the image above). Click Create.
To import the sample project:
- On the Assets menu, click Import Package > Custom Package.
- Browse to the location of the UnityGamepad repository on your computer and select the gamepad.unitypackage file. Click Open.
- In the Importing package dialog box, make sure that all of
the files are selected. Click Import.
You might receive a warning indicating that a texture must be marked as a normal map in the import settings. If this happens, click Fix now to proceed.
- In the Project window, in the
Assets/_scenes folder, double-click the
gamepad scene. In the Game window,
the scene for this project looks like this:
If your scene doesn't look like the image above (for example, the text labels aren't aligned correctly), make sure that you're viewing the scene in a 16:9 aspect ratio. In the upper-left corner of the Game window, click the current aspect ratio and select 16:9 from the list.
Configure your build settings
- Connect your device to your computer using a USB cable.
- On the File menu, click Build Settings. In this window, you can select the platform that you want to build for and configure the settings for each platform. You can also select the scenes that you want to include in your build.
- In the Scenes In Build section, make sure that the gamepad.unity scene is selected. If this scene doesn't appear in the list of scenes, click Add Current to add the current scene to the build.
- In the Platform section, click
BlackBerry. Here's what the lower section of the
Build Settings window looks like:
- In the Build Type drop-down list, click Local (Token Required). This field specifies whether you're building for testing on your own device using a debug token (the Local option) or for submission to the BlackBerry World storefront (the Signed option). When you're ready to submit your app for approval, you should select the Signed option.
- Click Switch Platform. This step places the Unity logo next to the BlackBerry entry
and ensures that you're building for that platform.
- Click Player Settings. The settings for the BlackBerry platform are displayed in the Inspector window. These settings let you specify how you want to build your project for the BlackBerry platform. You can set the default orientation, app icon, and other options.
- In the Inspector window, click Publishing
Settings. In this section, you can specify the details about the
device you're using. You can also create a debug token and upload it to your
- In the Device Configuration section, type the development IP address of your device (for example, 169.254.0.1) and your device password.
- In the RIM Signing Authority section, do one of the
- If the Registered field is set to Yes, make sure that the Path field contains the location of your code signing .csj files.
- If the Registered is set to No, click Register. Specify the locations of the .csj files that you received when you registered with BlackBerry, and type your PIN. In the CSK Password and Confirm CSK Password fields, choose a keystore password. This password is used to secure your signing keys on your computer. Click OK.
- In the CSK Password field, type your keystore password.
- In the Debug Token section, do one of the following:
- To import an existing debug token, click Import. Locate the .bar file that represents the debug token. Click Open.
- To create a debug token, click Create. In the Path field, type the location where you want to save the debug token, or click Browse and choose a location. In the Device PIN's section, type your device PIN in the field and click Add. Select the PIN and click Generate Token.
- In the Debug Token section, click Upload to upload the debug token to your device.
Build and run the sample project
- The Build Settings window should still be open. If it's not, on the File menu, click Build Settings.
- Click Build And Run.
- In the Build BlackBerry window, select a location and type a name for the .bar file. Click Save.
Depending on the BlackBerry 10 device that you're using, the sample app might not appear correctly on the screen. Don't worry too much about that; the purpose of these tasks is to configure your build settings and make sure that they are correct. If you're interested in learning the details of the UnityGamepad sample app, take a look at Tutorial: Support gamepads in Unity.
Last modified: 2014-05-14