- Home /
Ghosting bug on my android device
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);
}
What is the Clear Flags on your camera set to? I've seen that happen when you dont have one of your camera set to skybox or solid color... Hope this helps.
$$anonymous$$y initial setup was to clear flags on solid color and built using openGL 1.x. I've tried different combinations between the two and the only way that worked to get rid of the ghosting bug was to set clear flags to none and builoding it using openGL 2.x. I even tried adding a skybox and setting the flags on that but the result was the same.
Thanks for your answer, but I had hoped to resolve the issue and use the openGL 1.x to build the app in order to make it compatible with multiple devices.
Answer by rupeshpamaihgari · Aug 01, 2013 at 08:07 PM
While building,go to player settings and change the graphics level to openGL 1.x instead of 2.x .