I have a method called Grow that is for plants.
public void Grow() {
size = transform.localScale;
size.y = transform.localScale.y + 1f;
transform.localScale = size;
growCount++;
health++;
growSpot = transform.position;
growSpot.y = transform.position.y + 0.5f;
transform.position = growSpot;
}
I am trying to call it in void start and give it this if statement.
void Start () {
GetComponent(Grow);
if (growCount < 5) {
growCount++;
} else {
if (growCount == 5) {
growCount = 0;
}
}
}
But I can’t get it to work properly. I was getting a ton of errors but now it is down to these 2.
The best overloaded method match for UnityEngine.Component.GetComponent(System.Type)' has some invalid arguments. Argument #1’ cannot convert method group' expression to type System.Type’
edit: Those errors are both on the GetComponent(Grow); line.
I don’t know if I am just too tired to see the solution. But no matter what I do I can’t fix this. Any help is greatly appreciated by me and my stress levels.