Problem with ActiveInHierarchy checking if other gameobject is active.

Hello, im an newbie to Unity hovewer i have previous programming skills with Java and C++ so Unity is only a matter of learning its commands to me. I am making simple coin collecting game (Unity hello world!) and i made a win screen which shows up how much seconds it took to collect all (good) coins. The script that has to give information about how much time it took determines when it have to give final time by checking when is the win screen active (Its deactivated till you collect all 12 coins). Heres my script for it

    using UnityEngine;
    using System.Collections;
    using UnityEngine.UI;
    public class LicznikCzasu : MonoBehaviour {
    public GameObject licznik; // GUI time counter
    public int czas = 0; // Raw time
    public float sekundy = 0; // Seconds
    public GameObject wynik; // The final time count on win screen
    Text var1;
    	void Start() {
    	var1 = licznik.GetComponent<Text>(); //accesing text component
    	}
    	void FixedUpdate () {
    	czas++; // Initial counter
    	sekundy = czas / 50; // I found that its about a second. Dont judge me pls
    	var1.text = sekundy.ToString(); // So the  text component can eat it
    		if(wynik.activeInHierarchy()){ // this gives me error!
    		wynik.SendMessage("czas", sekundy.ToString()); 
    		}
    	}
    	void Kara(){ // punishment for collecting 'bad' coin
    	czas += 250;
    	}
    }

Apologies for variable names, im a messy person when it comes to it.

Cheers!

activeInHierarchy is a “property” which means you access it like you would access a field, not like a function.

So remove the () behind the activeInHierarchy and it should compile.

Some hints, if you want people to “judge you about this” ;): Time.time holds an increasing counter of “seconds since the game starts”. “Time.deltaTime” is the “seconds since the last call to the update”. This works in FixedUpdate too, in which case it simply points to Time.fixedDeltaTime. The reason your “50” works just fine is that you have the fixed delta time in “Edit/Project Settings/Time” left at its default value of 0.02. (0.02 seconds means you get 50 fixed updates per second).