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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Is there a way to activate a InvokeRepeating function after CancelInvoke()

Discussion in 'Scripting' started by solider, Jun 10, 2015.

  1. solider

    solider

    Joined:
    May 28, 2015
    Posts:
    9
    So in my game, in order to activate two points of shooting to fire for my spaceship, I deactivated the single shooting feature by CancelInvoke() function(The InvokeRepeating function allowed for bullets to spawn continously at one location). Now, I want to activate that single shooting feature after I CancelInvoke() the function already. Is there a way to reactivate a canceled-invoked function?
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,744
    Just call InvokeRepeating again?
     
  3. solider

    solider

    Joined:
    May 28, 2015
    Posts:
    9
    Ok. I'll try that. I thought there was a built in function or something. Thanks.
     
  4. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,380
    Yeah, it's a built in function called 'InvokeRepeating'.