- Home /
Built game freeze and re-work 5 seconds after
Hi there i'm a little guy who is making a game. :) I have a problem when i build my game for tests ( GUI , etc ). When my raycast ( like a crosshair ) activate a script, it freeze for 5s and re-work. Well it's embarassing... So here are the codes that are "activated" when I look at the object :
var ray : Ray;
var Pointeur_1 : GUITexture;
var Pointeur_2 : GUITexture;
var InfoIcon : GUITexture;
var hit : RaycastHit;
var Text : GameObject;
var Anim : GameObject;
var AudioFile : AudioClip;
function Update(){
ray = Camera.main.ScreenPointToRay (Vector3(Screen.width / 2, Screen.height / 2, 0));
if (collider.Raycast (ray, hit, 6.0)) {
Pointeur_1.active = false;
InfoIcon.active = true;
Pointeur_2.active = true;
Text.active = true;
}
else {
InfoIcon.active = false;
Text.active = false;
Pointeur_1.active = true;
Pointeur_2.active = false;
}
if (Pointeur_1.active){
audio.clip = AudioFile;
audio.Play();
}
if (Pointeur_2.active){
var AnimTest : AnimTest = Anim.GetComponent("AnimTest");
AnimTest.enabled = true;
}
}
Aaannd, this one :
var AudioFile : AudioClip;
var InceptionFail : GameObject;
var VraiInception : GameObject;
var InfoIcon : GUITexture;
var Text : GameObject;
function Update()
{
if(Input.GetKeyDown(KeyCode.E))
{
animation.Play("Take 001");
waitplusclick();
}
}
function waitplusclick()
{
yield WaitForSeconds(0.7);
Destroy (InceptionFail);
audio.clip = AudioFile;
audio.Play();
Destroy (VraiInception);
}
InceptionFail = The object with the first script VraiInception = The group where the object in the first scrip is.
Thanks in advance !
Comment
Your answer
Follow this Question
Related Questions
Unity3D freezes on Debian Linux 1 Answer
Are coroutines freezing my game? 0 Answers
My code freezes Unity... 1 Answer
Camera Change Bug 0 Answers
Unity3D Editor frozen after waking up PC from power save mode? 0 Answers