Search Unity

Deactivate function

Discussion in 'Scripting' started by Paykoman, Sep 2, 2015.

  1. Paykoman

    Paykoman

    Joined:
    Jun 26, 2014
    Posts:
    500
    Higuys.

    One simple question, is possible deactivate a function ínside one script from another script??
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    You can't 'deactivate' a function; a function is never 'active', it only sits there waiting to be called.*

    Could you give a little bit more context as to what you're trying to do?

    * Well, except for a coroutine; if that's what you're asking, there are StopCoroutine and StopAllCoroutines functions on MonoBehaviour.
     
  3. Paykoman

    Paykoman

    Joined:
    Jun 26, 2014
    Posts:
    500
    The contest is simple, im working in a click to move game, but im having a problem, when i have mouse over inventory i cant move but when i click and icon and i click it out of inventory it will be deleted, until here everything work fine. The problem is if i click and i simply move the icon out of inventory even dont click it the player start move alone and when i click to delete player move to the point i click.. so wt i need is stop player move when im working with icon of inventory, or at least if i hv 1 icon "hover" my mouse...

    Thats why i ask if i can, in this case, set the Move function to dont do it job xD