Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by fernansv · Feb 11, 2014 at 07:16 AM · android

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?

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Domain · Feb 11, 2014 at 07:34 AM 0
Share

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.

avatar image fernansv · Feb 12, 2014 at 02:36 AM 0
Share

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.

avatar image SunnyChow · Feb 12, 2014 at 02:40 AM 0
Share

may you show the script about controlling?

avatar image Domain · Feb 12, 2014 at 03:56 AM 0
Share

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.

avatar image fernansv · Feb 12, 2014 at 04:01 AM 0
Share

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 (); }

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

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);
 }

}

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges