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
0
Question by nirenyang1 · Jun 25, 2012 at 03:16 PM · coroutineeventbooienumerable

Coroutine couldn't be started! [BOO]

Hi! I'm a newbie and think BOO's great. So I have some test try to put a Coroutine Function into a Variable. What's the "Coroutine couldn't be started!". Please?

There script has been copyed and changed form Unity3d Document. http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.StartCoroutine.html

 import UnityEngine
 import System.Collections
 
 class Parent (MonoBehaviour): 
     public cmd as callable(single) as IEnumerator 
     
     def Awake ():
         cmd = WaitAndPrint
         return
         
     def Start ():
         print(('Starting ' + Time.time))
     
         StartCoroutine('cmd', 2.0)
                 //Coroutine 'cmd' couldn't be started!
                 //UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
                 //Test:Start() (at Assets/Test.boo:15)
 
         print(('Before WaitAndPrint Finishes ' + Time.time))
 
     def WaitAndPrint(waitTime as single) as IEnumerator :
         yield WaitForSeconds(waitTime)
         print(('WaitAndPrint ' + Time.time))



Any help will be deeply appreciated.

Comment
Add comment · Show 3
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 flaminghairball · Jun 25, 2012 at 04:10 PM 1
Share

You're trying to start a coroutine named 'cmd' - but you don't have a function in your file with that name.

avatar image DannyB · Jun 25, 2012 at 04:20 PM 0
Share

@Fla$$anonymous$$gHairball he has defined cmd as a function pointer in Awake so calling cmd() should be just like calling the function it points to ( WaitAndPrint() ), at least this is how I read the code.

avatar image Bunny83 · Jun 25, 2012 at 04:25 PM 1
Share

Yes, that's what he does. He created a function pointer / delegate that is named "cmd", but it's not a function, it's a variable. The string version of StartCoroutine will try to execute a function on the script with that name that doesn't exist.

2 Replies

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

Answer by DannyB · Jun 25, 2012 at 04:05 PM

I am not writing in Boo, but shouldn't it be one of these:

 StartCoroutine('WaitAndPrint', 2.0F);

or

 StartCoroutine( cmd(2.0F) );
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 Bunny83 · Jun 25, 2012 at 04:36 PM 0
Share

Yes, i guess it should be something like that ;) But i'm also not a Boo user (who is? :D).

It's not a bad thing to use Boo, but most people use UnityScript or C#. There are only a few Boo users out there, so don't expect too much help here ;)

Since boo is also some kind of a standardized .NET language, you might get more help on boo forums or the developer page.

However what the OP has tried here won't work in any language that is supported by Unity.

avatar image
0

Answer by nirenyang1 · Jun 26, 2012 at 07:28 AM

Thanks all of you.

Danny is right. I thought that's the different usage by the same function. It's seems I was wrong.

BTW, I known C# has more users. My chosen is follow my heart :) I will try it until forced to face some big problem.

Best regards!

Comment
Add comment · Show 2 · 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 Mizuho · Jun 26, 2012 at 07:32 AM 0
Share

As such, you should mark his answer correct :D.

avatar image nirenyang1 · Jun 28, 2012 at 06:49 AM 0
Share

Oops~ I found that green tick Finally :) Thank you $$anonymous$$izuho~

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

7 People are following this question.

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

Related Questions

Rerun a script after it finishes, when it already has multiple Coroutines? 1 Answer

How to change this using a coroutine 1 Answer

Starting and stopping Coroutines 1 Answer

Adding a coroutine to an event? 6 Answers

Ienumerator wait for event 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