Hi guys i have a problem, and i been seraching but i cant find anything, the problem is that i have two instanciated prefabs attach to my main camara, so when i do a certain action on the screen for each of them, it is suppouse to reveal them, for the the one i got problems this is the code, i already attach him from the herachy to the prefab , i think anything is good, but only works in one of my two prefabs for this i , im like a new to unity, i already read the API for several functions but i cannot find and awnser for this, so i hope some one can help me, heres the code.
using UnityEngine;
using System.Collections;
public class blue : MonoBehaviour
{
public GameObject azul;
int counter =0;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
if (Input.GetMouseButtonDown(0))
{
counter = counter + 1;
}
if (counter==15)
{
var position = new Vector3(332,258,0);
var objectPos = Camera.main.ScreenToWorldPoint(position);
Instantiate(azul, objectPos, Quaternion.identity);
counter = counter + 1;
}
}
}