Build not working as expected

I’ve been developing a game that when I run it inside Unity works perfectly, but when i run the build (for windows and web), certain things are not working.

  1. When the game starts I implemented a countdown (get ready,… 3, 2, 1, Go,… and then the game starts). In the build version, the countdown never starts (the user gets stuck in the screen saying “get ready”)

  2. the menu screen is not showing properly. The menu is being cut although inside Unity it’s showing as it should.

Can you please help?

Here is the link to the [web] build:
http://www.game4tress.com/latest.aspx
(I provide the link instead of the actual page because the actual page is always changing, depending on the version)

My thanks in advanced

Can you post here your countdown code, to help you better, and how it setUp in the Inspector.:sunglasses:

Hi,

First of all thanks for your reply.

I’ve already solved the secound problem. I just have to use the resolution "web (1024 x 768).
About the countdown,… well it’s somehow complex because it consists of several scripts. that access public variables. I’ll try to place the code here tomorrow

Best Regards,
Ricardo

That is an good news :slight_smile:

Well, this is the code that I’ve placed inside a 3D asset. This code uses a timer to update other assets.
I’,m sorry I’ve placed all the code in the script, but all the functions are responsable, more or less, for the timer update.

private enum position
{
left=0,
right=1,
center=2

}

var speed : float = 10.0;
var speedIncrement:float=2; //Increment for this craft
var TurnSpeedIncrement:float=1; //Increment for when this craft turns
var rotationSpeed : float = 100.0;
private var m_general:general;
var _cameraFP:Camera = null;
var _cameraWV:Camera = null;
var getreadyText:TextMesh;
var timer: float = -2; // set duration time in seconds in the Inspecto

//Timer
private var startTime;
private var restSeconds:int;
private var roundedRestSeconds:int;
private var displaySeconds:int;
private var displayMinutes:int;
private var m_position:position;

var countDownSeconds:int=120;

function Awake(){
m_position=position.center;
startTime=Time.time;

m_general.currentSystemState=m_general.systemState.PAUSED;

m_position=position.center;
general.StartUpText=0;
/*var guiTime=Time.time+startTime;

//m_position=position.center;
restSeconds=countDownSeconds-(guiTime);
m_general.p_timer=guiTime;*/
}

//Game rendering
function OnGUI(){

}

function Start () {

_cameraFP = GameObject.Find(“MainCamera”).camera;

if (_cameraFP == null)
Debug.Log(“Start(): First Person Camera not found”);

_cameraWV = GameObject.Find(“earthlingMainCamera”).camera;

if (_cameraWV == null)
Debug.Log(“Start(): Wide View Camera not found”);

//SelectCamera(0);
}

function Update () {
var bolEntered:boolean;
var guiTime=Time.time+startTime;

//m_position=position.center;
restSeconds=countDownSeconds-(guiTime);
m_general.p_timer=guiTime;

bolEntered=false;

if(m_general.currentSystemState==1)
{

var xRotation:int;

xRotation=0;
//Keyboard Input
if(Input.GetKeyDown(“up”))
{
speed+=speedIncrement;
//m_general.currentSystemState=0;
}
if(Input.GetKeyDown(“down”))
{
speed+=speedIncrement;
//m_general.currentSystemState=0;
}
if(Input.GetKeyDown(“left”))
{
/speed-=TurnSpeedIncrement;
rotationSpeed+=TurnSpeedIncrement;
xRotation=-30;
/
if(m_position!=position.left)
{
speed-=TurnSpeedIncrement;
rotationSpeed+=TurnSpeedIncrement;
xRotation=90;
bolEntered=true;

if(m_position==position.center)
{
m_position=position.left;
Debug.Log (“left”);
}
else
{
if(m_position==position.right)
{
m_position=position.center;
Debug.Log (“center”);
}
}
}
else
{
m_position=position.left;
bolEntered=false;
xRotation=0;
Debug.Log (“left”);
}
//transform.Translate (0, 0, xRotation*3);
//m_general.currentSystemState=0;
}
if(Input.GetKeyDown(“right”))
{
/speed-=TurnSpeedIncrement;
rotationSpeed+=TurnSpeedIncrement;
xRotation=30;
/

if(m_position==position.right)
{
m_position=position.right;
bolEntered=false;
xRotation=0;
Debug.Log (“right”);
}
else
{
speed-=TurnSpeedIncrement;
rotationSpeed+=TurnSpeedIncrement;
xRotation=-90;
bolEntered=true;

if(m_position==position.center)
{
m_position=position.right;
Debug.Log (“right”);
}
else
{
if(m_position==position.left)
{
m_position=position.center;
Debug.Log (“center”);
}
}
}

//transform.Translate (0, 0, xRotation*3);
//m_general.currentSystemState=0;
}

if(speed<0)
speed=0;

// Get the horizontal and vertical axis.
// By default they are mapped to the arrow keys.
// The value is in the range -1 to 1
var translation : float = Input.GetAxis (“Vertical”) * speed;
var rotation : float = Input.GetAxis (“Horizontal”) * rotationSpeed;

// Make it move 10 meters per second instead of 10 meters per frame…
translation *= Time.deltaTime;
rotation *= Time.deltaTime;

// Move translation along the object’s z-axis

transform.Translate (0, 0, translation);
// Rotate around our y-axis

//transform.Rotate (0, rotation+xRotation,rotation);
if(bolEntered==true)
{
transform.Rotate (0, 0,xRotation);
}
if(m_position==position.left)
{
transform.Rotate (rotation, 0,0);
}
if(m_position==position.right)
{
rotation*=-1;
transform.Rotate (rotation, 0,0);
}

}

}

function SelectCamera(cameraIndex:int)
{

if (_cameraFP != null)
_cameraFP.camera.enabled = (cameraIndex == 0);

if (_cameraWV != null)
_cameraWV.camera.enabled = (cameraIndex == 1);

}

function theTime(){
timer += Time.deltaTime;
if ((timer > 0) (timer <2)){

general.StartUpText=1;

}
else if ((timer > 2) (timer <4)){

general.StartUpText=2;
m_general.currentSystemState=1;
}
else if ((timer > 4) (timer <6)){

general.StartUpText=3;
m_general.currentSystemState=1;
}
else if ((timer > 6) (timer <8)){

general.StartUpText=4;
m_general.currentSystemState=1;
} else {

getreadyText.text=“dd”;
guiText.text = “TIME OVER\nPress X to restart”;

}

}

function toDo(){
switch(m_general.p_timer)
{

case 9:
general.CameraControl=1;
m_general.currentSystemState=1;

break;
}
}

Ok, thanks for your help anyway, but I already solved the problem.
The problem was in Time.time. Some changes were necessary, but I change the code to use Time.deltatime.
Although the problem is solved I’m intrigued in knowing why Time.deltatime works on the build version and Time.time doesn’t