Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by importguru88 · Jul 14, 2016 at 04:18 AM · c#scripting problemerror

Health.cs(331,22): error CS1624: The body of `Opsive.ThirdPersonController.Health.DieLocal(UnityEngine.Vector3, UnityEngine.Vector3)' cannot be an iterator block because `void' is not an iterator interface type

I have legacy animations . I try to make the death animation play late because of the animation frame is not keep up when its deactivating the object. I need to start a start a Coroutine some where on this network health script. The script is long . I will only show you the codes where the errors are at .

I try to code and I gotten two of the same errors :

Assets/Third Person Controller/Scripts/Health.cs(331,22): error CS1624: The body of Opsive.ThirdPersonController.Health.DieLocal(UnityEngine.Vector3, UnityEngine.Vector3)' cannot be an iterator block because void' is not an iterator interface type

Assets/Third Person Controller/Scripts/Health.cs(56,21): error CS1624: The body of Opsive.ThirdPersonController.Health.StartSinking()' cannot be an iterator block because void' is not an iterator interface type

    public void StartSinking()
         {
             isSinking = true;
             print("Starting " + Time.time);
         yield return StartCoroutine(WaitAndPrint(2.0F));
         print("Done " + Time.time);
         }
 
     // Deactivate the object if requested.
             if (m_DeactivateOnDeath) {
                 Scheduler.Schedule(m_DeactivateOnDeathDelay, Deactivate);
                     yield return null (.05);
                     this.animation.Play("die");
                     GetComponent<AudioSource>().Play();
             
             }

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
0
Best Answer

Answer by jdean300 · Jul 14, 2016 at 04:41 AM

Coroutines should return IEnumerator:

 public IEnumerator StartSinking()
 {
     //Code goes here
 }

I also don't think yield return null (.05); is going to work. If you're trying to wait for .05 seconds then use yield return new WaitForSeconds(.05f);

Comment
Add comment · Show 3 · 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 importguru88 · Jul 14, 2016 at 05:04 AM 0
Share

Do you mean this way ?

public IEnumerator StartSinking ()

{

  StartCoroutine(Wait(3.0f));

}

avatar image jdean300 importguru88 · Jul 14, 2016 at 05:08 AM 0
Share

No, I mean in the if statement you posted. yield return null (.05); shouldn't even compile. Let me check real quick.... yeah that doesn't compile.

I'm not sure what you are trying to do with the (.05), but if it is to wait for .05 seconds then continue the coroutine then you want`yield return new WaitForSeconds(.05f);`.

Also, unless you have defined a Wait coroutine yourself, Unity does not have one. You probably mean to use WaitForSeconds

avatar image importguru88 jdean300 · Jul 14, 2016 at 05:13 AM 0
Share

I have the project it's small . If you want to take a look at it .

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

184 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 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 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 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 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 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 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 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 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 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 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 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 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 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 avatar image avatar image

Related Questions

Hey guys, im starting do make a RPG game and in the Level system script(I called it "PlayerStatsController") i have an error: Parser Error : Unexpected symbol `public'. My script above: 1 Answer

Error CS0029: Cannot implicitly convert type to UnityEngine.UI.Transform 1 Answer

C# Cannot reference scripts on the FirstPersonCharacter 3 Answers

My Script Wont work? 2 Answers

How can i make both two cameras to follow the player but only one with control on player ? 0 Answers


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