The silent problem of Skaudionode in Xcode7.3.1 after scene conversion

Source: Internet
Author: User

Panda Pig • Patty original or translated works. Welcome reprint, Reprint please indicate the source.
If you feel that the writing is not good please more advice, if you feel good please support a lot of praise. Thank you! Hopy;)

The Skaudionode code that works well before the new Xcode seems to have some minor problems, which happens after the scene transitions.

For example, game home View Gamescene creates a new instance of itself after new game and then transforms the past:

"GameScene")            newScene!.scaleMode.AspectFill            let reveal = SKTransition.flipHorizontalWithDuration(0.5)            self.view?.presentScene(newScene!, transition: reveal)

Note that a sktransition instance is used to create the transition effect, with a transition time of 0.5 seconds. The test found that if you use Skaudionode to play a sound in the scene loading method, you can only play 0.5 seconds and then it will be silent. If the transition time changes, The Skaudionode playback time also changes. No matter what, just complete the transition and the sound disappears!

Beginning to think that the old scene needs to do the cleanup, so wrote the following method:

override func willMoveFromView(view: SKView) {        iflet music = bgMusic{            true            music.removeFromParent()            bgMusic = nil        }        iflet music = bgMusicAlarm{            true            music.removeFromParent()            bgMusicAlarm = nil        }    }

But the problem remains.

Then the original scene loading method play sound to do a small delay operation, there is no problem, good magic!

runAction(SKAction.waitForDuration(0.01),completion:{          self.playBgMusic("SpaceGame.caf")        })

The silent problem of Skaudionode in Xcode7.3.1 after scene conversion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.