Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by WarLordYT · May 29, 2013 at 07:49 AM · functioninvokeinvokerepeatingrepeatrepeating

Invoke.Repeating doesn't really "care" about repeat time?

My invoke.repeating doesn't seem to "care" about the repeat time at all? it just repeats incredibly quickly regardless of the time? Thanks

 var Player : GameObject;
 var Arms : GameObject;
 
 var Ak74uShot : GameObject;
 var AcrwShot : GameObject;
 var KnifeShot : GameObject;
 
 var Ak74uRange : int = 125;
 var AcrwRange : int = 100;
 var KnifeRange : float = 0.75;
 
 var WeaponInt;
 
 private var Ak74uFire : boolean = false;
 private var AcrwFire : boolean = false;
 
 
 
 function Start ()
 {
     
     
     
 }
 
 function Update ()
 {
     var Ak74uRay : RaycastHit;
     var AcrwRay : RaycastHit;
     var KnifeRay : RaycastHit;
     
     var WeaponInt = Player.GetComponent("Weapon Switch").GunEquipped;
     
     
     
     if (WeaponInt == 1)
     {
         if (Input.GetMouseButton(0))
         {
             Physics.Raycast(Ak74uShot.transform.position, Ak74uShot.transform.forward, Ak74uRay, Ak74uRange);
             Ak74uFire = true;
             InvokeRepeating("Ak74uDamage", 0, 200000000000);
         }
     }
     
     if (WeaponInt == 2)
     {
         if (Input.GetMouseButton(0))
         {
             Physics.Raycast(AcrwShot.transform.position, AcrwShot.transform.forward, AcrwRay, AcrwRange);
             AcrwFire = true;
             InvokeRepeating("AcrwDamage", 0, 200000000000);
         }
     }
     
     if (WeaponInt == 3)
     {
         if (Input.GetMouseButtonDown(0))
         {
             Physics.Raycast(KnifeShot.transform.position, KnifeShot.transform.forward, KnifeRay, KnifeRange);
             Debug.Log ("Melee");
         }
     }
     
     Ak74uFire = false;
     AcrwFire = false;
     
     
     
 }
 
 
 
 function Ak74uDamage()
 {
     Arms.animation.CrossFade("Rifle Recoil");
     Debug.Log ("AK74U Fire");
 }
 
 
 
 function AcrwDamage()
 {
     Arms.animation.CrossFade("Rifle Recoil");
     Debug.Log ("ACR-W Fire");
 }
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Fattie · May 29, 2013 at 07:50 AM

There is a famous bug in InvokeRepeating.

The first argument cannot be 0.0

Make the first argument say 0.0001

It's really amazing the guys at unity have not had a chance to fix this!

It's possible you have some other problem but this is the likely problem. Cheers

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image isteffy · Aug 31, 2015 at 06:07 AM 0
Share

Thanks. $$anonymous$$y invokeRepeating does not change the speed in which it repeats. It's a little silly Unity hasnt been able to fix this

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is it possible to change Invoke Repeating rate on the fly? 3 Answers

InvokeRepeating doesn't work 2 Answers

Call a function repeatedly while a boolean is true 3 Answers

InvokeRepeating doesn't work at 0.00002 seconds 2 Answers

InvokeRepeating affecting parts of script 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges