- Home /
android and unity.
I recently finished the space shooter project in unity3d website and the games runs on the web brower bit when i build the android version and installed the apk the game launched and ran, i just cant control the space ship. Is there any complete tutorial for using unity to male an android game?
You're going to have to give a lot more details if you want us to help you solve the space ship controlling problem. As for the tutorials, there's a ton on youtube.
Ok here i go, i completed the space shooter project on Unity3d website. The project was a success and i was able to finish it and play it. Now i wanted to build an android version of the same project, when i did i got an apk file. I installed the apk on my phone and ran the game. The game boots and i can see the game but i cannot move the spaceship around, i can only shoot once i touch the screen but on swipe nothing happends.
are you using On$$anonymous$$ouseDown() for your shooting? If so, that's why it works on android too. To control the spaceship, though, you're going to need an on-screen joystick or some other means of input.
It takes a bit of work to transform a PC game into an android game. I'd suggest watching some tutorials on how to make an android game, and try to use the lessons you learned to fix your game.
this is what i am using for the shooting.
void Update () { if (Input.GetButton("Fire1") && Time.time > nextFire) { nextFire = Time.time + fireRate; Instantiate(shot, shotSpawn.position, shotSpawn.rotation); audio.Play (); }
Answer by fernansv · Feb 12, 2014 at 02:50 AM
sure, here is the player controller script,for some reason the shooting works whenever i tough the screen but i cant move.
this is a little more organized for better reading, i used C#
http://unity3d.com/earn/tutorials/projects/space-shooter/moving-the-player
using UnityEngine; using System.Collections;
[System.Serializable] public class Boundary { public float xMin, xMax, zMin, zMax; }
public class PlayerController : MonoBehaviour { public float speed; public float tilt; public Boundary boundary;
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rigidbody.velocity = movement * speed;
rigidbody.position = new Vector3
(
Mathf.Clamp (rigidbody.position.x, boundary.xMin, boundary.xMax),
0.0f,
Mathf.Clamp (rigidbody.position.z, boundary.zMin, boundary.zMax)
);
rigidbody.rotation = Quaternion.Euler (0.0f, 0.0f, rigidbody.velocity.x * -tilt);
}
}
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
UnitySocketIO sending a websocket message to nodejs 1 Answer
Can't use Unity Remote 4 in Unity 4.5 1 Answer
native android plugin 0 Answers
Converting Android Axis to Unity Axis 0 Answers