- Home /
build not working right , script added
MY game works in the unity preview but not when i build it , mac version ( I only have a mac )
It is just the starting level where an eagle should collect 12 orbs to learn how to fly .
The orbs (pickup) should disappear when the eagle ( player) passes through them , and a sound should play , in the mac build when the eagle hits an orb, it moves off in a direction and keeps going , no sound plays either . I think this is the problem script but i have not tried to make a build since i upgraded to 5.3 from 4 so it could be anything .
using UnityEngine; using System.Collections;
public class pickUps : MonoBehaviour {
public float speed;
public GUIText countText;
public GUIText winText;
public AudioClip droplet;
private int count;
private AudioSource source;
void Start ()
{
source = GetComponent<AudioSource>();
count = 0;
winText.text = "test";
SetCountText ();
}
void FixedUpdate ()
{
gameObject.GetComponent<Renderer>().material.color = Color.green;
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
GetComponent<Rigidbody>().AddForce(movement*speed);
}
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "PickUp")
{
other.gameObject.SetActive(false);
count = count + 1;
SetCountText ();
source.PlayOneShot(droplet,1f);
}
}
void SetCountText ()
{
countText.text = "Count: " + count.ToString();
if(count >= 12)
{
winText.text = "Task completed - Press Escape to Quit";
}
}
}
We're going to need more detail to help with this.
Edit your question to include code and explain exactly what is happening and what should happen.
Your answer
Follow this Question
Related Questions
Windows phone 8 port failing during build 0 Answers
Getting Error building Player: Exception: Invalid PBX project (parsing line 0) 0 Answers
Building apk for android error: failed to re-package resources 1 Answer
But the dll is not allowed to be included or could not be found. 0 Answers
CommandInvokationFailure: Failed to re-package resources after integrating Chartboost 2 Answers