Is my MonoDeveloped Glitchd ???

I know the title must explain the situation…

First I could do a loop in the start

Yesterday i was coding and i see this error saying that Object reference not set to an instance of an Object then i checked what it means(Im not english so…) Readed again and i thaught that was C# that didnt recognized my object so i did in the start method

> void Start () { Instantiate(edificio)
> //ignore here transform.position = new
> Vector3 (500,100,500);

} Pressed play and my pc lags so MUCH when i looked in the hierarchy more than 200 objects were cloned…

Sharing Integers and bools and Other stuff

So i wanted to make a camera like MOBA Stile But I also wanted that if a bool was true the camera (teleportates) to the object that is being atacked(once again bool checks that) But then One thing happened: The camera only goes 1000 x 500 of the terrain (Looks it is because of the screen) And then i tryed this code to see if this works:

public float goX ; public float goY ; public float goZ ; private float X; private float Y; private float Z;
public int getVida; private int setVida; public bool atacado;//atacado means atacked
void Start () {
getVida = setVida; setVida = 100; goX = X; goY = Y; goX = Z; X = transform.position.x; Y = transform.position.y; Z = transform.position.z; } void Alerta1(){ if (atacado == true) { if (getVida != 0) { atacado = true; }else{ if (getVida == 0) { atacado = false;
} } } }
void Update () {

if (Input.GetKey (“a”)) { setVida = setVida - 20; atacado = true; Alerta1 (); } else { if (getVida == 0) {//vida means life in portuguese Debug.Log (“MORRI”);//dead … DestroyObject (this);
} } }
}// i did put all the code to see were i was going tried to do it but this two problem appeared

Couldnt share Int or Bools or other ints

     if(GameObject.Find("edificio").GetComponent<vidaEdificioScratch>().atacado == true){
         setX = GameObject.Find ("edificio").GetComponent<vidaEdificioScratch> ().goX;
         setY = GameObject.Find ("edificio").GetComponent<vidaEdificioScratch> ().goZ;
         setZ = GameObject.Find ("edificio").GetComponent<vidaEdificioScratch> ().goY;
     }

and then this problem happens if (Input.GetKey ("a")) { setVida = setVida - 20; atacado = true; Alerta1 ();

it keeps doing the code without pressing the letter

Hard to understand your question. What is the exact problem/error? If the variables goX, goZ, goY are public, then they should be accessible.

Are you sure the problem is not that setX and SetY are being set with Input.mousePosition at the start of each frame? I mean there’s no use setting SetX, SetY, SetZ with GameObject.Find after the transform.position if Input.mousePosition sets them beforehand.

i maded that way to look more
confusing if they entered the source
of the game

Don’t do that. This shouldn’t even be a concern. Keep code easy to read and understandable, for your own sake and for other developers.