I’m trying to build a tiny turn-based battle engine and I hit a roadblock adding ‘buffs’ to my characters. I have the buffs as children of a parent class called ‘Status’ and am trying to add them to my Character class as components. I had it working just fine once, but I tried to make the function adding the component more generic and now get the error
no appropriate version of ‘unityEngine.GameObject.AddComponent’ for the argument list (Status) was found
Adding the buff component - contained in and called by my parent skill class:
function addStatus(user: Character, buff: Status){
var nStatus = user.gameObject.AddComponent(buff);
}
this is how I am calling the addStatus, inside a child skill ‘shield’:
var buff: shielded;
super.addStatus(user, buff);
shielded is a child of the Status class. All of these classes are contained in different .js files.
This same code works when I put a specific ‘buff’ into the call = addComponent(shielded); So I assume I’m just using the function wrong or I have completely misjudged how to go about this problem.
If you need to know anything more specific to see what is going wrong, please let me know. Thank you,