• 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 BarbaricCo · Aug 04, 2013 at 06:54 PM · yield4.13.5.7

After upgrade to Unity 4.1 yield not working?

Does anyone experienced anything similar. It's just yield WaitForSeconds () inside function (JS). After upgrade to v4.1 all calls to this function from another script don't execute after yield statement? All was working perfectly in Unity 3.5.7. Thanks

Comment
Add comment · Show 4
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 KiraSensei · Aug 04, 2013 at 07:13 PM 0
Share

I didn't have any trouble with WaitForSeconds while changing of version. Are you sure you didn't change anything in your script ? $$anonymous$$aybe you can post the part that is not working so we will be able to help you...

avatar image BarbaricCo · Aug 04, 2013 at 08:13 PM 0
Share

Nothing is changed in scripts. This is original main script:

 // Original script in 3.5.7
 function SpecialAction (expPosition :  Transform, distance : int) {
        CameraShake (expPosition);
        // Other stuff
        ... 
 }
 
 function CameraShake (shineExpPosition : Transform) {
        ...
        yield WaitForSeconds (0.2);
        ... 
 }

I resolved this with adding another function inside main script that is calling function with yield statement like this:

 // modified script for Unity v4
 function SpecialAction (expPosition :  Transform, distance : int) {
        YieldCameraShake (expPosition)
        // Other stuff
        ... 
 }
 
 function YieldCameraShake(expPosition) {
        CameraShake (expPosition);
 }
 
 function CameraShake (shineExpPosition : Transform) {
        ...
        yield WaitForSeconds (0.2);
        ... 
 }

Only thing I can think of is that this is hapening when SpecialAction is called from another script (enemy or bomb) and before yield is over that object is destroyed. Again it worked perfectly in 3.5.7. and I now resolved it but would like to know if it's anything changed in a way Unity4 handles yield. Thanks

avatar image KiraSensei · Aug 04, 2013 at 09:28 PM 0
Share

How did you solve it if nothing has changed ?

avatar image BarbaricCo · Aug 05, 2013 at 07:03 AM 0
Share

I just adden new "middleearth" function that calls function with yield statement?

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

15 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

Related Questions

Null Reference Exception after updating from 4.0 to 4.1.5 (coroutines) 0 Answers

How to implement a delay between each time my gun fires (using coroutines or otherwise)?... 2 Answers

In c#, how to yield until a download is complete? 1 Answer

C# version of yield when loading a scene? 1 Answer

yield WaitForSeconds makes GUI button disappear 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges