Using debug.log to check the boolean every update, in the script holding the boolean it finds it as false - in another script checking the same boolean, it finds it as true. This is thoroughly confusing to me as the code that would change the boolean to true at any point never activates.
using UnityEngine;
using System.Collections;
public class Connector : MonoBehaviour {
int activeCount;
bool active = false;
public GameObject[] activators;
void Update () {
Debug.Log("Active count: " + activeCount + " - activator length: " + activators.Length + " - active is set to: " + active);
activeCount = 0;
foreach(GameObject activator in activators){
if(activator.GetComponent() != null){
if (activator.GetComponent().active == true){
activeCount += 1;
}
}
}
if(activeCount == activators.Length){
active = true;
}else{
active = false;
}
}
}
using UnityEngine;
using System.Collections;
public class Open : MonoBehaviour {
public float openLimit = 3f;
public bool open = false;
public float openThreshold;
public float openingSpeed = 5.0f;
public int openGridmultiplier = 1;
public bool usesGravity = true;
public bool selfCloses = true;
public float closeThreshold;
public Transform myTransform;
public Vector3 myPos;
public GameObject activator;
Trigger trigger;
Button button;
Connector connector;
void Start(){
closeThreshold = transform.position.y;
openThreshold = transform.position.y + openLimit * openGridmultiplier;
myTransform = transform;
myPos = transform.position;
if(activator.GetComponent
↧