Unity3d for iOS Beginner Tutorial: Part 1/3 (top)

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/alongu3d/archive/

If the picture is not visible, please check the original

This textbook is from the Tutorial team member Christine Abernathy, who is an engineer on Facebook's development support team.
Unity is one of the most popular game engines. This is for good reason: Unity has a powerful visual editor that makes it easy to get started, powerful, good community support, attractive prices, and more!
If you're eager to try unity, there's nothing better for you than this tutorial! In this tutorial, you'll learn how to create a simple iOS game with unity – and don't have to have any experience before!:]
In this tutorial, the simple game you want to create is to allow the player to reach the end of the obstacles along the way in a limited time.
In the process, you will be introduced to Unity's development environment and workflow, and learn the basic concepts of game design.
This tutorial will be divided into three sections:
In the first part, by creating a game, this game has a simple character with a control mechanism through which you learn to use Unity's basic operations. You will also learn how to deploy projects to the iOS platform.
In the second part, you will learn how to use the built-in controller objects and scripts in the standard library to enhance the movement of the characters, how to debug with unity remote, and how to beautify the game scene.
In the third part, you will add game rules to your project and build the concept of game design, which includes adding precast parts, timers, menus and sound effects to enhance the gameplay experience.

Ready to add a powerful new frame to your skill bar? Please read on!:]

Let's get started.

As you complete this series of tutorials, you will be familiar with Unity's development workflow, which consists of four basic sections:

    1. Build your game scene in Unity editor
    2. Writing scripts with Monodelelop Editor
    3. Remote Debugging with Unity Romote
    4. Publish to your iOS device with Unity Editor

In the first part of the tutorial, you will install unity, learn the basic features of the editor interface, and then create a project to introduce you to the basic concepts of the game.
At the end of the first part, you'll get a role in the game that can be moved by touching the trigger. You'll also test your project on the Unity editor and iOS devices.
This tutorial uses the Unity version 4– if you haven't installed it, go ahead and download unity.
Unity offers a full-featured, professional version with 30-day free trial time. This version allows you to develop the game and can deploy the game and run it on the iOS platform. While unity can run on Mac and Windows platforms, this tutorial is based on the MAC environment.

Note: The unity package is quite large and almost 1G, depending on the speed of your network link, it will take some time to download. If you want to start right away, please download it in advance. :]

Create a project

When you're done downloading and installing unity, turn on unity. If this is your first time starting unity, you will be prompted to activate your program. Select the Activate the free 30-day trial of Unity Pro option as shown in the screenshot below:

Then you need to create a unity account, if you haven't, confirm your email address and then sign in with unity.
When you log in, you will be asked some questions. If you turn to the bottom of the list, then click "Not right now." So you can skip these questions:]. Finally, you can start using unity.
At this point, a default project is created and presented in front of you – just like this:

Throw that project away and create a new project by selecting FileNew project in the menu. A Project Guide will be presented in front of you:

In the Project Wizard, click "Set" and navigate to the folder where you want to save the item. Enter Dashandzag as the project name, click "Save", and finally "Create project". (You will be asked if you want to save the previously opened default item, but you can choose not to do so unless for some reason you want to keep it ...) )

Note: During the project creation phase, this project tour includes some standard libraries that you can import. Now ignore this. You will import the libraries you need later in this tutorial.

Unity closes the current project and launches it again with your new project:

Ah ha, a brand new canvas! But what exactly are these control bars, windows, and tab bars? Where do we start?

Start learning about the UI ...

It's worth taking some time to tweak the Unity editor interface that really fits you, so let's take a look. Stop at the Layout tab bar of the editor in the upper right corner. Change the window mode to wide:

Here you see the scattered parts, each with a highlight:

    • Project view: The contents of the resource directory that your Unity project contains will be displayed in this column. Here are scripts, scenes, preforms and other unity objects that you create.
    • Hierarchy (Hierarchical list) View: This contains the gameobject in the current scene. In Unity games, each object that appears is called Gameobject. These objects can be simple objects that you create from the Gameobject menu, or resources that you import. Your initial project contains a gameobject: the main camera.
    • Toolbars: Toolbars allow you to manipulate objects in the scene view or game view to control how your editor view is displayed, and to control the preview of the game in the editor.
    • Scene view: In this view, you can place your gameobject position to build your game. This scene view includes a scene gizmo (the one with an axis in the upper right corner) that indicates the current position of the scene lens.
    • Game view: This is a visual angle from your in-game camera. When you click on the play button above the toolbar, you will see this game view. Alternatively, you can toggle the game and Scene view from the tabs at the top of the window.
    • Inspector (Checker): This item provides further details about the selected gameobject. You can change the properties of these objects, such as size, location, or the associated script to change the behavior of this gameobject.

You will be skilled in using the Transform tool in the toolbar to place the Gameobject and wander through the scene view. OK, let's go to the next section:

Get a handle

Hand tools let you control your perspective in the scene

The best way to understand hand tools is to imagine yourself falling into a 3D scene with lots of gameobject around it. The objects in front of you are visible, and those behind you are invisible.
You might want to step back in the scene so you can see a larger view, move left or right to see other objects, or rotate and pan to see what's behind you. This hand tool is for you to do this.
As you begin to add more and more gameobject, you will find that you will use this tool more and more to adjust your perspective in the scene before placing Gameobject.
To see how the hand tool works, first select it (at the far left of the toolbar) and select the main camera from the hierarchy view (just let you have something to see in the view of the scene). You can drag the canvas to move the entire scene.
To zoom, you can use your mouse wheel, or control-click and drag the mouse. You can rotate by dragging the mouse by holding down the option key. If you want to reset your perspective at any time, you can click on one of the gizmo axes in the upper right corner of the scene.

Play a hand tool until you are skilled in moving around the scene and can use the control and option combinations to zoom and rotate.
You often have to switch between the hand tool and other tools, so it is necessary to remember its shortcut keys. By default, these keys are next to each other, in the upper left corner of your keyboard –q, W, E, and R, respectively, representing hand, Move, rotate, and scale.

Note: The hand tool does not move the object. It only changes the perspective of your scene, so it looks as if the object was moved. Use the various hand tool options to practice moving around the scene.

Move it or let it go.

With the Move tool, you can move gameobject in 3D space.

Select the main camera (if you don't see it in the scene view, you can double-click it in the Hierarchy view), then click the Move tool. You should see a gizmo appearing on the side of the main camera with arrows representing three axes. With these, you can move this object:

The red arrow represents the X-axis, the green arrow is the y-axis, and the blue arrow is the z-axis. You can move a gameobject by selecting the object, holding down the left mouse button, and then dragging in the gizmo.
Check the main camera and move it. Take a look at the transform component in Inspector. The position column has x, y, and Z values that represent the position of the gameobject. When you move objects, notice the changes in these values.

You can change the transform position of the gameobject by using the Move tool, or enter the location you want directly in these input fields.
If you want to move the object in one direction only, select the appropriate axis in the Gizmo, hold down the left button, and drag the axis. By simply moving the main camera on the x-axis to test this, and viewing it in inspector, only the value of x-position has changed. Repeat the same action on the Y and Z axes.

You already know how to change your personal perspective in the scene and how to move objects in the scene. So far have been good oh!

You take me for a spin

Rotate tool allows you to rotate gameobject in 3D space

To understand the rotate tool, and to know how to use it, it is necessary to discuss the scene's gizmo in more depth. The scene's gizmo can be found in the upper right corner of the scene view, with different views having different modes.

There is a pattern (like the one on the bottom left) that lets you observe your scene in a free way through a 3D perspective. This is very useful if you want to better represent your game in 3D space.
You can click on the text below the gizmo to switch to the isometric view (as shown in the lower right image). This mode is more visible when an object is rotated.

Another pattern is the x-axis view, which allows you to see your scene as if you were looking down the x-axis. This mode is useful if you want to move an object on the Y-or z-axis and keep the x-axis intact.

In a similar way, you have a Y-and z-axis pattern that allows you to get a view of the scene from that direction.


Select the main camera. Right-click on the Gizmo and select free to switch to freeform mode.

Then click on the text below the gizmo to switch between isometric and perspective modes. Repeatedly click the x-y-and z-axis modes to observe the changes in the scene gizmo and scene perspective.
Select the free view again to test the rotation. When the main camera is still selected, click the Rotate tool. You should see a gizmo appear on the main camera, which contains a different color ring representing three axes of rotation.

Left click on the center of the main camera and drag with your mouse to rotate the main camera. When you rotate this object, notice the change of the Transformrotation property of the inspector. Note that you can manually edit these values in inspector if you wish.
Click on the center location of the main camera and you are going to rotate freely along all axes. By clicking on the ring representing the color of an axis, you can rotate the gameobject along this axis. For example, if you just rotate along the x-axis, click the red circle to select it, and then hold down the mouse and drag to rotate the object. Repeat the same steps if you want to rotate along the Y or Z axis.

It all boils down to the point of view

Another key worthwhile learning concept is the difference between local and global (world) perspectives.


Reset the rotation angle of the main camera to 0,0,0 through the Inspectortransformrotation field. Click on the toolbar called "local". Then select the Move tool so that you can see the gizmo of the scene:

Note that the gizmo of the scene is consistent with the gizmo direction of the main camera. In the scene, the x-axis points in the same direction, and the Y-and Z-axes are the same. Now use inspector to set the Transformrotation value to 0, 0-20, to rotate the main camera along the z-axis.

Note that the main camera gizmo now rotates around the z-axis – This means that the object's axis is in its own local coordinate system. This is different from the scene Gizmo, where the scene coordinates show the operation of the global space. Switch to a global perspective to see the difference.
Later in this tutorial, you will learn how to move Gameobject and find that you will find the difference between the different spaces (world or local) that you specify when moving objects.
Take a look at the rotated main camera, if you move it in the X-direction of the local coordinate control, it will not be the same as the final position where you move it in the same direction as you do in world coordinates. Put that in your head and it will be useful in the future!
Before you continue, reset the rotation angle to 0, 0, 0, and let's go back to a clean state.

Zoom Tool

The zoom tool allows you, as you have guessed, to scale gameobject on the dimensions

Compared to other gameobject, you can only change one of the three axes, and of course you have the option to change the Inspectortransform component to replace the tool.
Select the main camera, then note the Zoom Gizmo, which contains a square handle at the end of each axis, and one in the middle.
To scale freely in all axes, select the square in the middle of the object, then left-click, then move up to let the Gameobject zoom in, and move it down to make it smaller. Take a look at the properties of the Inspectortransformscale. When you zoom in or out of this object, you should see the numbers become larger or smaller.

By selecting the red Gizmo handle, the test zooms along the x-axis and then holds the handle outward. Use Inspector's Transformscale x-value to check that only one has changed. Also try the Y and Z axes.
After you have played these control buttons, reset the main camera to the following settings under the Inspectortransform column:

    • Position:0,1,-10
    • rotation:0,0,0
    • scale:1,1,1

Your transform menu should look like this:

In this tutorial, you will learn about other editor interface components. This includes using the play button to play a game and using the Unity debugger.

No other than loneliness: add Gameobject

Now that you've touched on some basic concepts, you're going to start adding gameobject to the camera--it's only yourself, and it's really lonely:]
Now the camera is facing a very desolate world. Don't be afraid – be prepared to add a block type of gameobject to represent the protagonist, and a flat type of gameobject to represent the floor where the protagonist moves.
When you use Unity to design a game, the best practice is not to use any fancy resources to represent a protagonist in the game to be developed. In this way, you can focus on optimizing gameplay and moving the protagonist without being distracted by other image elements.

Another point of note is that unity is a good game engine, but you don't want to use it to create image resources. In the graphics department, there should be a lot of tools that are pretty good
, and unity is good at importing resources from a wide range of those tools.
Typically, the division of typical game development is that game development uses unity to develop gameplay, while art designs parallel the use of their favorite image tools to create various resources. When the two sides work convergence, it is reasonable to import the image resources to enhance the game.
Now that you've come to know the point, let's get started! By selecting Game objectcreate otherplane. Add a planar type of gameobject to represent the ground.
This new planar gameobject should appear in the hierarchy view. Select the ground in the hierarchy view, and then use Inspector to set the Transformposition to 0,0,0. Then use the inspector to magnify it to 50, 1, 50. Your scene will look like this:

Next, you'll add the protagonist Gameobject, which will be represented by a block in your game. That's it, heroic little squares!
Select Game Objectcreate Othercube, then a new block type of gameobject will appear in the hierarchy view. Select the block in the hierarchy view and set the Transformposition to 0,0,0 with inspector. Your scene should look like this:

Click the Move tool, and then click the y axis of the scene gizmo to move only constrained in the y-axis direction. Move up the heroic little square to make it slightly higher than the ground (floor). You can also set the transform position to 0,1,0 to move the cube up a little bit.
Now it's time for excitement – click on the Play button (at the top) on the toolbar of the Unity Editor to preview your game:

You are testing your game using the Unity Editor. This editor should switch to the game view, and you should see something like this

The view of the game you see is what you see through the main camera in your scene. Your protagonist, this heroic little square, appears in the distance, above the ground-a man's world, but the brave stand there!
Since you haven't added any other components to change the player's behavior, nothing happens in the game. In addition, there are some dark scenes. Next, you can add a light source to your scene first.
Stop the game preview by tapping the play button again. Back in the scene view, add a light source. Choose Game Objectcreate Otherpoint light. In general, move the light source to the origin before adjusting its position in the future. Use inspector to set transform position to 0,0,0.
Now adjust the height and brightness of the light source so you can see more of the scene. Here's a tip: Use the Move tool, then move the constrained movement along the y-axis.
To adjust the brightness, modify the range and intensity settings in the light component. Use the "hand" tool to rotate, if you want to get a better view of the scene.
A good way to see if you have enough light is to use the game panel to switch to the game view (the equivalent of clicking the play button). Try it back and forth until you can see your character:

When you're done adjusting, click on the play button to fit your changes. When you switch to the game view, your view should look similar to the following:

Congratulations, you've recently added this tutorial at this stage all the gameobject! you need to remember, as a good practice, you first have to focus on gameplay and then add image elements.
Now that you've done something meaningful, go ahead and save the scene in the project. A project can consist of one or more scenes. In the game, you can think of a scene as equivalent to a level of the game.
In this tutorial, you save each part of the tutorial as a scene. This is the concept of creating a magic game level, but it allows you to reuse those resources from one scene to another.
To save the scene, select FileSave scene, and in the Save Scene dialog box, name your scene level_1. Your project view should be updated with the scene you just created.

Start Move: Event function

The game is currently too static! It urgently needs movement to make it move.
You can add a move by creating your own script or using a pre-packaged script associated with the associated Gameobject to perform an action. For example, in the first part of this tutorial, you will create a script that moves your character when the player is touched. The script you create needs to respond to touch events to change the position and rotation angle of the heroic small squares.
Unity supports the following languages for scripting: JavaScript, C #, and Boo. In this textbook, you will use JavaScript. Unity's scripting language includes pre-defined event functions that you can use to define the behavior of a gameobject.

    • The event function you are going to use frequently is the update () function. If you define this function in your script, it will be called once per frame. The content displayed by your game is redrawn once per frame, so the update function is responsible for displaying the updates at a specific frame rate.
      A game runs at a certain number of frames per second, and one thing to keep in mind is that this frame rate is very dependent on the game's platform and is also being used by other applications to occupy the operating system's resources. What this means is that you should not do anything sensitive to events, and you cannot assume that it will be called at a fixed frequency.
    • Another pre-defined event function, Fixedupdate (), is called by a fixed frequency, independent of the frame rate just mentioned. If your script defines this function, it will be called at a fixed interval (the invocation and invocation are quite different from the Update method).
      In the Fixedupdate function, you should be able to handle any physics-related work, because the physical computations are very time-sensitive. For example, you can have a game object that uses a physical engine, such as a rigid body (you'll learn more about that later). When this object collides with other objects and you want to calculate the force acting on the object, you should do it in the Fixedupdate () function.
      For things like changing the position or rotation of an object, it's best to do it in the update () function.
    • A third useful function is start (), which is called before the first frame update occurs. You will typically place the initialized operation here.
    • Finally, the awake () function is called when the game starts. It is another good place to put the initialization code.

The right touch.

Let's give it a try. Create a new script by selecting Assetscreatejavascript. A new script with a default name of Newbehaviorscript appears in the Project view. Click in the name of the script and rename it to Movesimple.
Double-click the script to open it. It should open in the monodevelop of the bundled Unity editor and then contain the following code:

#pragma strictfunction Start () {}function Update () {}

The Start () and update functions have been created for you because they are frequently used functions. You do not need the start () function now. After the #pragma line, add the following variables to control the movement and rotation speed of the heroic small squares:

var speed:float = 3.0;var rotatespeed:float = 10.0;

Replace the empty update () function with the following code:

function Update () { Detect Mouse left clicks if (Input.getmousebuttondown (0)) {//Check if the gameobject are clicked by casting        A//Ray from the main camera to the touched position.        var Ray:ray = Camera.main.ScreenPointToRay (input.mouseposition);        var hit:raycasthit;        Cast a ray of distance, and check if this//collider are hit. if (collider.            Raycast (Ray, hit, 100.0)) {//Log a debug message Debug.Log ("moving the target"); Move the target forward transform.                   Translate (Vector3.forward * speed); Rotate the target along the y-axis transform.        Rotate (Vector3.up * rotatespeed);        } else {//Clear the debug message Debug.Log (""); }    }}

Save your changes.
This code first looks at the mouse click event, especially the input of the left mouse button. The parameter "0" means left click, "1" means right click, "2" means middle key click, when we use Getmousebuttondown function. If the click is monitored, then the code builds a ray from the main camera to the mouse click position.
Collider. The Raycast () function monitors whether the colliding body associated with this script is hit by a ray. If the collision body hits, this collider. The Raycast () call returns TRUE. This function has three parameters:

    1. You build the Rays.
    2. A Raycasthit object that will contain more information if the collision occurs.
    3. A parameter for the length of the ray.

Assuming that there is a true result, the following code pushes your character forward, based on the speed variable, and rotates your character on the basis of the rotatespeed variable. Transform. Translate () to move the position of the gameobject, specifying the direction and distance through its Vector3 input.
Vector3 is a 3D vector that represents the direction and length of an object, or a vector. This vector can be broken up into X, Y and z three parts.
In the code, your heroic little square is the distance to move forward a variable that is multiplied by speed. Vector3.forward is equivalent to Vector3 (0,0,1), and the speed multiplier is 3, which will make the block move Vector3 (0,0,3)
The direction of the character movement is in the local space of the character. To experience this direction, check the box, then use the Move tool and view the z-axis direction. That's the direction the character is going to move.
Transform. The Rotate () function rotates the gameobject according to an angle of the Vector3 input. The Euler angle is used to describe the rotation of the gameobject. In this rotating case, the object rotates the Euler angle Z degree along the z axis, the X-degree of Euler's angle along the x-axis, and the Y-degree of Euler's angle along the y-axis.
In the above code, use Vector3.up or vector (0, 1, 0) to rotate the character, which indicates rotation along the y axis. This angle of rotation is multiplied by the rotational speed. This rotation is relative to the local coordinate system of the character. So your heroic little square will rotate along its y axis, as you know, as opposed to rotating along the world's coordinate system.

Note: A real game does not use this type of movement to control a role. They are used here for the purpose of simply demonstrating the basic concepts involved in moving gameobject, and the parts behind this tutorial are replaced by more reasonable moves.

The

contains two Debug.Log () statements in this piece of code. This log output is printed to Unity's console when the game is running. You can see the output of the last log at the bottom of the Unity editor. You can also open the console by selecting Windowconsole to view the output of the log, and also to clear the log.
You can also keep your eyes on the bottom of the Unity editor and focus on the output of the log, where any script errors will be displayed.
through the code, now you have defined a behavior. You can assign this script to a gameobject. Select the block in the hierarchy view and select Componentscriptsmove simple. This step is called adding a script behavior to a gameobject, you just select the script that you have created (called movesimple).

Note that the inspector now contains a move simple script bar. The public variables you define in the code, speed and Rotatespeed, are visible in the Inspector view. You can modify these variables to change the associated gameobject behavior without having to modify the script.
This means that if you have two characters in the scene with Movesimple scripts associated to them, under the Inspectormove simplespeed field, by increasing the speed value, make one character move faster than the other.
Click Play to play the game, touch the character, and then notice the transform position and rotation attributes changed in inspector.

Note that the transform position changes from 0,1,0 to 0,1,3– in other words, there are 3 units of movement in the z-axis direction because of the speed multiplier relationship. The rotation also transforms from 1,1,1 to 1, 10, 1, which is very close to the Rotatespeed multiplier.
When the game is running, you can change the speed and rotation variables in inspector. After clicking on a character, increase the speed and observe the transformation position.
Stop the game, and then note that the observation speed and rotation angle variables are set to their original values. Any changes you make while playing the game are temporary. This gives you the opportunity to tinker with various settings and then return to the initial setup status when you have finished your preview. If you want a lasting change, you can do it again before you test the game.
Note that when you play the game, the console logs accurate debugging information based on whether the player is clicked or not clicked.

On the camera, too.

You'll notice that when you move the heroic little box, he leaves the camera farther and further away – it's not a good feeling. Just like a responsible parent, you want to keep a fixed distance by modifying your game, letting the main camera chase after your character. This is a typical technique for third-person games.
Select Assetsimport packagescripts and then in the items to import section, select only the Smoothfollow script and click Import

Note: If you do not get the Import selection dialog box, when you choose Assetsimport packagescripts, then try to quit unity and then restart. This is effective for me.

A new standard assets folder in your project view should appear there. If you navigate to its subfolders, you should be able to see also smoothfollow scripts. Double-click the script to open it in MonoDevelop, so you see the key part of the code.

var target:transform;

The above represents the public variables used for tracked targets. The location information of the target is used to set the follower's position and rotation angle.
The follower's position and rotation angle are set in Lateupdate (), which is another pre-defined event function. This function is called after the update () function is complete. You can put the code that relies on those actions that occur in update () there.
The camera can update its own position and rotation angle in the Smoothfollow script's lateupdate () when the position and rotation of the heroic small square are changed by the update () defined in the Movesimple script.

.. var wantedrotationangle = Target.eulerangles.y; 1var currentrotationangle = Transform.eulerangles.y; Currentrotationangle = Mathf.lerpangle (Currentrotationangle, Wantedrotationangle, rotationdamping * Time.deltaTime); var currentrotation = Quaternion.euler (0, Currentrotationangle, 0); Transform.position = target.position; 2transform.position-= currentrotation * Vector3.forward * distance;transform.position.y = currentHeight;.. Transform. LookAt (target); 3..

Here are the key points of the above code:

    1. Calculates the rotation angle that the follower needs to match the rotation of the target. This rotates along the y axis.
    2. Relies on an offset from the distance variable to keep the follower behind the target. Also use the result of # # to rotate the follower along the Y axis. Finally ensure that the follower is at a fixed height above the target.
    3. Ensure that the follower always faces the target

Now associate the script to the main camera. Select the main camera in the hierarchy view, and then select Componentcamera Controlsmooth Follow:

Check that the new column for smooth follow has been added to the inspector of the main camera.
Note that at this point, the target variable is not assigned a value, and there is a none on its side. You want to assign a block gameobject to this input. When the main camera is still selected, then in Inspector smooth follow script is visible, drag the block Gameobject from the Hierarchyshi view to the target variable. Another option is that you can select a list of objects by clicking on the small circle with a point on the edge of the target value.

The target variable should be linked to the block (your character).
Click the Play button. You should see the changes in the view immediately, just as you look down at a given height. Click on the player to move it, then watch how the camera follows the player. Note the location information of the main camera in the inspector, and then it changes when the heroic little block moves.
Stop the game and then save the scene before going to the next step.

Deploy to iOS

If you're like me, you can't wait to see how this works on your iOS device. :] The good news is that the trial version of Unity Pro allows you to test your project on iOS.
Testing your Unity project on a real-world device is a good practice (i.e. not an emulator). You don't want your test to go to the simulator, that's all you can do. Because game development relies heavily on related hardware, you should test on the actual device so that you can spot performance problems as early as possible.
To deploy to an iOS device, you need to sign up for an Apple developer account so you can have device deployment capabilities. If you haven't, go to Apple and spend 99 dollars – we'll be right here waiting for you.:]
Unity can create a Xcode project for your game, allowing you to deploy to an iOS device. To complete this step, select Filebuild Settings:

Select the iOS platform, and then click Switch Platform. Then click on the Player Setting button and you can find this button at the bottom of the Build Settings dialog box. The Unity Editor's inspector should show the player Settings, where you can customize the parameters you need for your iOS deployment. Modify it according to the following:

Resolution and Presentation

    • Default Orientation: Landscape Left

Other settings

    • bundle Identifier: Bundle Identifier is required to properly build your app on your device.
    • SDK Version: Device SDK
    • Target iOS Version: 4.3

Go back to the Build Settings dialog box. In the scene list of the build section, add the scene that you want to generate the Xcode project in. Because your project has only one scene, there's no need to move your mind. Add the Level_1 scene by clicking the Add Current button.

Click the Build button to start the build process. You will be asked to specify the location to save this Xcode project. Navigate to the location you want to save to save your Xcode project, enter DASHANDZAG in the Save As field, and choose Save.

Unity creates the Xcode project, and then opens the folder that contains the Xcode project files. This project will have a file called Unity-iphne.xcodeproj.

Open the project with Xcode, make sure scheme is set to Unity-iphone, select your device, and compile the project.

Run the app. You should first observe a splash screen as the Unity Default logo. Then your game should appear:

Touch this heroic little square and let it move around. You have built and deployed your first unity project on iOS.

Unity3d for iOS Beginner Tutorial: Part 1/3 (top)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.