Unity has this sample project "Roll a Ball" at this link: https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial
I have been able to build and make it work 100% well on my Mac. I am able to use the arrow keys on the keyboard to move the ball. Everything works on the Mac platform.
However, when I use the same code to build and deploy this game on my iPad, I notice that the ball does not move at all when I use my fingers to try to move the ball. (The only good thing is that all the cubes are rotating well)
So, my question is if I need to modify the C# script for the ball to make it works for iPad (although that script already works for Mac) ?
Here is the C# script for the ball:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PlayerController : MonoBehaviour
{
public float speed;
public Text countText;
public Text winText;
private Rigidbody rb;
private int count;
void Start ()
{
rb = GetComponent<Rigidbody>();
count = 0;
SetCountText ();
winText.text = "";
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag ( "Pick up"))
{
other.gameObject.SetActive (false);
count = count + 1;
SetCountText ();
}
}
void SetCountText ()
{
countText.text = "Count: " + count.ToString ();
if (count >= 12)
{
winText.text = "You Win!";
}
}
}
*Interestingly, I have just noticed that the type INPUT has the method "GetTouch()". Maybe, I could try to use that method for iPad ? Initially, I was hoping that the generic code in the C# script above that works for Mac could also work for iPad ? Maybe, my assumption was wrong and I need to write a different set of code with "GetTouch()" for iPad ? OK, I am thinking that is the possible solution, and will try that now... *
PS: BTW, I am using the latest Unity (version 5.5.2f1) and latest XCode (8.2.1) as of Feb 2017. The iOS on my iPad is also the latest (version 10.2.1).