This question was
closed Aug 05, 2019 at 01:03 PM by
Alex_lemes for the following reason:
SOLVED
Question by
Alex_lemes · Aug 05, 2019 at 10:14 AM ·
c#errorerror message
Stuck with - Invalid Cast Exception
Hello,
I'm currently stuck with an issue and cannot seem to find an answer, any help would be great.
I keep getting "InvalidCastException: Specified cast is not valid" with my buffing system.
Error from line: healOverTime = (HealOverTime)buff;
private HealOverTime healOverTime;
public HealOverTimeBuff(float duration, ScriptableBuff buff, GameObject obj, float tickRate) : base(duration, buff, obj, tickRate)
{
this.character = obj.GetComponent<Character>();
if (this.character == null)
{
End();
return;
}
healOverTime = (HealOverTime)buff;
}
HealOverTime inherits from ScriptableBuff class.
Thanks!
Comment
Follow this Question
Related Questions
"The associated script cannot be loaded" 0 Answers
How can I solve this error? 1 Answer
C# unexpected symbol error 1 Answer
"The associated script cannot be loaded." 0 Answers
Сonstructor return null 0 Answers