- Home /
Static int wont change from another script
i have a quest where you have to go and find a gameobject and press E and then you should be done with that and my int should rise with one and when it hits 4 it should stop the mission. Here is the scripts,
using UnityEngine;
using System.Collections;
public class FjellProveTaking : MonoBehaviour {
public bool FjellProveTatt = false;
// public bool shitfuckingshit = false;
public GameObject FjellObject;
public GameObject PressE;
public static bool collidercheck = false;
// Use this for initialization
void Start () {
PressE.SetActive(false);
}
// Update is called once per frame
void OnTriggerStay (Collider other) {
if (collidercheck == true && FjellProveTatt == false)
{
// shitfuckingshit = true;
PressE.SetActive(true);
if(Input.GetKey(KeyCode.E))
{
FjellMaste.Fjellprovercounter += 1;
FjellObject.SetActive(false);
FjellProveTatt = true;
PressE.SetActive(false);
}
}
}
}
using UnityEngine;
using System.Collections;
public class FjellMaste : MonoBehaviour {
public static int Fjellprovercounter = 0;
public GameObject Fjellmission;
public bool Missionfinshed = false;
public int provercounter = 0;
// Use this for initialization
void Start()
{
provercounter = Fjellprovercounter;
}
// Update is called once per frame
void Update()
{
}
public void ProveChecker()
{
if (Fjellprovercounter == 4)
{
Fjellmission.SetActive(false);
Missionfinshed = true;
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612090358im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
cannot implicitly convert type 'int' to 'bool' problem 1 Answer
Distribute terrain in zones 3 Answers
Static Integers Problem 1 Answer
When is a static game object static? 1 Answer