Hi there, I am new to unity and C#, but I am not new to programming.
I got this error when trying to pass gameObject to a method call like like this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AbilityHandler : MonoBehaviour
{
public Ability ability;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(key))
{
ability.Activate(gameObject); //<-- error points to this
}
}
}
The method that I am calling is from this:
public class Ability : ScriptableObject
{
public new string name;
public float cooldownTime;
public float activeTime;
public virtual void Activate(GameObject parent){}
}
And I am getting this error:
I was under the impression that gameObject can be referenced anywhere in a MonoBehaviour script