I’m trying to disabling a Sphere at the start of the scene. The Sphere has a child object that I also want disabled, but for some its not doing it.
var bouncie : GameObject;
var seconds = 0.0;
var running = false;
function Start () {
bouncie.active = false;
}
function Update () {
if (running) {
timeLeft = seconds - Time.time;
timeLeft = Mathf.Max (0, timeLeft);
seconds -= Time.deltaTime;
}
if (seconds <= 0.0)
{
bouncie.active = true;
}
var hit : RaycastHit;
for (var evt : iPhoneTouch in iPhoneInput.touches)
{
if (evt.phase == iPhoneTouchPhase.Began)
{
var ray = camera.main.ScreenPointToRay(evt.position);
if(Physics.Raycast(ray, hit, 50) hit.collider.tag == ("Blue")) {
if (iPhoneInput.touchCount == 1) {
if (iPhoneInput.GetTouch(0).tapCount == 1) {
bouncie.renderer.enabled = false;
Debug.Log("Hit");
}
}
}
}
}
if (bouncie.renderer.enabled == false) {
bouncie.active = false;
}
}