Instantiate Problem

Hai there, i have a character movement script for android platform. My character is working left, right, down, up…, i have to instantiate bomb(object) when i press bomb icon. I modify my web game script into mobile, here is the script.

// Create Bomb…

	if (Bomb_Button.HitTest(Input.GetTouch(0).position))
	{
		if(Instance == true)
		{
			Bomb_Temp = Instantiate (Bomb, Bomb_Place.transform.position, Quaternion.Euler (0, 0, 0)) as GameObject;
			Explosion_Position = Bomb_Temp.transform.position;
			Explosion_Rotation = Bomb_Temp.transform.rotation;
			Bomb_Click = true;
			Instance = false;
			Expose_Instance = true;
		}
	}

	if(Bomb_Click == true)
	{
		Bomb_Time += Time.deltaTime;
		if(Bomb_Time >= 3f)
		{
			Destroy(Bomb_Temp);
			Bomb_Time = 0;
			Bomb_Click = false;
			Bomb_Visible = true;
		}
	}

	if(Bomb_Visible == true)
	{
		if(Expose_Instance == true)
		{
			audio.PlayOneShot (Explosion_Sound);
			Explosion_Temp = Instantiate (Explosion, Explosion_Position, Explosion_Rotation)as GameObject;
			Expose_Instance = false;
		}
		Explosion_Time += Time.deltaTime;
		if(Explosion_Time >= 2f)
		{
			Destroy(Explosion_Temp);
			Explosion_Time = 0;
			Bomb_Visible = false;
			Instance = true;
		}
	}

Actually i used this same script for my web platform(Changing controls into keyboard), working perfectly with that.

-Prasanna

You don’t ask a question, nor explain what this script is doing or not doing. One problem is that you can only create a bomb if ‘Instance’ is true, but the only place you set it to true is on line 233 which I believe is your explosion code. Maybe ‘Instance’ should be initialized to ‘true’ on line 39.