Like the Title says I have a problem with the my Update().
While writing my script I tested it continuous and all was fine but now it stoped working and i dont know why. I serched the error but couldn’t find it. Then i wrote a Debug.Log to test if Update() is called but it ist’t.
And Sorry I am german so the code may include some silly german-english words.
Here is the Script:
using UnityEngine;
using System.Collections;
public class Hafen_Anklicken : MonoBehaviour {
void Update () {
Debug.Log ("Update is called");
Hafen_Öffnen ();
}
void Hafen_Öffnen(){
if (Input.GetKeyDown (KeyCode.Mouse0)) {
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, out hit, 100)) {
if (hit.collider.gameObject.tag == "Seekarte_Hafen") {
bool Kapitän_Anwesend = false;
GameObject[] Kapitäne = GameObject.FindGameObjectsWithTag ("Kapitän");
for (int i = 0; i < Kapitäne.Length; i++) {
if(Kapitäne*.transform.parent.gameObject == hit.collider.gameObject){*
-
Kapitän_Anwesend = true;* -
}* -
}* -
if(Kapitän_Anwesend)* -
{* -
hit.collider.gameObject.transform.parent.GetComponent<Werft>().Starthafen = true;* -
gameObject.GetComponent<Kamera_Umschalten>().Hafen_Cam ();* -
Schiffsauswahl.Schiff = null;* -
}* -
else* -
{* -
GameObject[] Schiffe = GameObject.FindGameObjectsWithTag ("Schiff");* -
int Anzahl = 0;* -
for (int i2 = 0; i2 < Schiffe.Length; i2++)* -
{* -
Anzahl++;* -
}* -
if(Anzahl == 0)* -
{* -
if(Kapitän_Anwesend){* -
hit.collider.gameObject.transform.parent.GetComponent<Werft>().Starthafen = true;* -
gameObject.GetComponent<Kamera_Umschalten>().Hafen_Cam ();* -
}* -
}* -
else{* -
if(hit.collider.gameObject.transform.parent.gameObject == Schiffsauswahl.Schiff.GetComponent<Hafen>().Momentaner_Hafen)* -
{* -
hit.collider.gameObject.transform.parent.GetComponent<Werft>().Starthafen = true;* -
gameObject.GetComponent<Kamera_Umschalten>().Hafen_Cam ();* -
Shut_All_Windows.Shut_All = true;* -
}* -
}* -
}* -
}* -
}* -
}* -
}*
}