Search Unity

Health System? Errors

Discussion in 'Getting Started' started by phantomunboxing, Feb 11, 2016.

  1. phantomunboxing

    phantomunboxing

    Joined:
    Nov 10, 2015
    Posts:
    43
    http://pastebin.com/CEhfuv2D
    I am getting one error "Only assignment, call, increment, decrement",ect.
    I am very new at coding so I TAKE EVERYTHING LITERALLY...
    Thanks for the help :D
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    You'll get more/better answers if you paste your code here, using code tags, rather than using PasteBin.

    Also, when you have an error, it helps to report the exact error — use copy/paste if necessary. Don't paraphrase; the details often matter.

    In this case, though, the compiler's basically saying "Huh?" And I agree with it:

    Code (CSharp):
    1.            GetComponent<Character>().Health - AmountOfDamage;
    2.            GetComponent<Character>().Health >= AmountOfDamage;
    This code makes no sense, and I can't even guess what you mean by it.

    A good habit to get into would be to comment your code, before you actually write the code. That will force you to both think and express clearly what it is you're trying to do, which results in fewer errors, and when you do have errors, more help as people can actually understand your intent.
     
    Schneider21 likes this.