hi unity i hope some1 can point me in the right direction,
basicly i have an object, a snow man, when i hit the snow man i want a gui to block the screen wait a few seconds and fade out, like the squid ink in mario super karts
if i add my script to the snow man in the scene, the trigger works and the gui pops up, ( the alpha decreasing to fade out is not working)
the problem is my snowman object must be instanciated and it wont let me put my GUItexture object in to the variable GUI1 of my prefab in my project window,
i have been hunting and trying for last 2 days to solve this, i am new still to coding and unity but trying my best to learn, any help in this or the alpha problem is greatly apriciated
here is my code:
var collectSound:AudioClip;
var spawnpoint: Transform;// position of spawn
var particle: GameObject;// object to spawn
var GUI1: GameObject;
var FadeNum : float = 0.12;
var displayFor : int= 3;
var alpha : float=1;
function OnTriggerEnter (other : Collider){
if (other.gameObject.tag == “Player”)
{
AudioSource.PlayClipAtPoint(collectSound, transform.position);
Instantiate(particle, spawnpoint.position, spawnpoint.rotation);
GUI1.guiTexture.enabled = true;
yield WaitForSeconds ( displayFor);
//GUI1.guiTexture.color.a = alpha- (FadeNum* Time.deltaTime );
//if (alpha < 0.1){
GUI1.guiTexture.enabled = false;
Destroy(this.gameObject);
}
}
//}