Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Setting Scale vector other.

Discussion in 'Scripting' started by ClawbatPokémon, Aug 19, 2014.

  1. ClawbatPokémon

    ClawbatPokémon

    Joined:
    Jun 4, 2013
    Posts:
    13
    I want to enlarge an object ingame with push of a button,but I do not want it to enlarge every time i press the button, which is because of adding the value of scale not setting.

    I mean

    += or -=
    But i want it to go like this
    = or == but I just won't have any effect when I push the button.

    Any other method of doing this?

    By the way I am learning c# by now,that is why i ask uestipns frequently,but my project is going smooth hopefully it will reach beta in 2-3 months.
     
  2. RockoDyne

    RockoDyne

    Joined:
    Apr 10, 2014
    Posts:
    2,234
    += and -= aren't overloaded operators for the vector classes. There is no difference between using currentScale+=addedScale and currentScale= currentScale+addedScale though. It's the same operation, just shortened.
     
  3. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,738
    For fun, I googled this typo. The results are pretty funny.
     
  4. ClawbatPokémon

    ClawbatPokémon

    Joined:
    Jun 4, 2013
    Posts:
    13
    These types of typos aren't. Uncommon if you're typing from your phone while in a bus.

    But when I press the button more than once it increases again and again.
     
    Last edited: Aug 20, 2014