Question by
replay55 · Nov 18, 2015 at 08:36 PM ·
staticnon-static
Non-Static Member
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class firetrigger3 : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (victorycell.washit >= 3 && victoryballcell.winner >= 1){
GetComponent<ParticleSystem>().Play();
GetComponent<Light>().intensity = 8;
GetComponent<MeshRenderer>().enabled = true;
Transform.FindChild("powerCell3").SendMessage("cellwait");
}
else {
GetComponent<ParticleSystem> ().Stop ();
GetComponent<Light>().intensity = 0;
GetComponent<MeshRenderer>().enabled = false;
}
}
}
The error is asking me to make line 17, 'Transform.FindChild...' a static member. I understand how to make variables static, but, this isn't exactly a variable, or in any case, I have no idea how to make it static.
Comment
Answer by rutter · Nov 18, 2015 at 08:38 PM
It's important to understand the difference between a class and an object.
A class is a blueprint for an object. Plans to build a house are not the same as a house.
The keyword Transform
refers to a class. You probably mean to use transform.FindChild
, which refers to an object.