When running the app in my unity it performs just fine, but after building the app, installing the .apk, and running it on my device I get a ghosting bug on my moving cubes.
In unity
on my device
This is my code, I have a cube spawner that makes instances which move from the center of the screen towards where the screen was touched:
Spawner.js
var Cam : Camera;
private var screenCenter = Vector2(Screen.width/2, Screen.height/2);
private var pos : Vector3;
var Fireball : Transform;
function Start () {
}
function Update () {
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) {
pos = Input.GetTouch(0).position;
var hit: RaycastHit;
var ray : Ray = Cam.ScreenPointToRay (pos);
if (Physics.Raycast(ray, hit)) {
if (hit.rigidbody != null){
if (hit.collider.gameObject.name == "Screen Plane") {
SpawnFireball (hit.point);
}
}
}
}
}
function OnGUI () {
GUI.Label (Rect (pos.x-10, (Screen.height-pos.y)-10, 300, 20), "x="+pos.x+" y="+(Screen.height-pos.y));
}
function SpawnFireball (Lookatpoint: Vector3) {
var fireballInstance = Instantiate(Fireball, Vector3 (0, 0, 0), Quaternion.identity);
fireballInstance.transform.position = Vector3 (0, 0, 0);
fireballInstance.transform.LookAt(Lookatpoint);
}
Fireball.js
function Start () {
Destroy (gameObject, 3);
}
function LateUpdate () {
transform.Translate(Vector3.forward * Time.deltaTime * 5);
}