ios


How can I preload an SKScene?


Okay so I have to Scenes: TitleScene and GameScene. Obviously there is a lot of stuff in GameScene and that resulted in something very annoying. I have a play-button in the TitleScene and whenever that gets pressed I present the GameScene.
I do that like this:
In TitleScene.m :
-(void)didMoveToView: (SKView *)view {
if(!self.contentCreated) {
self.createSceneContents;
self.contentCreated = YES;
}
}
-(void)createSceneContents {
//among other TitleScene stuff
self.gameScene = [GameScene sceneWithSize:self.frame.size];
self.gameScene.scaleMode = SKScaleModeResizeFill;
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInNode:self];
if ([self.playButton containsPoint:location]) {
[self.view presentScene:self.gameScene];
}
}
The Problem is that whenever I press the play-button it causes like a second to two seconds of lag before transitioning to the next scene.
I create the GameScene just like the TitleScene with a lot of stuff in the createSceneContents method. I know it is not the simulators fault, because I tested it on my iPhone 6.
Can I pre-load all the GameScene's stuff when the app is first opened, or is there another way to stop this lag?

Related Links

Deep linking in iOS 10 not working
Command /bin/sh failed with exit code 133 - CocoaPods error macOS Sierra
Bluetooth LE on iOS10 strange behavior
add handle to uiScrollView like in the screenshot
Xcode unexpectedly quit while reopening windows every time
How to set up UIBezierPath border for view in ios?
Trying to parse JSON in Swift, but get error
Crashlytics does not show crashes
Data out of sync using same account on different devices
How to stop every action in a GameScene in Swift/iOS
IOS App contains multiple storyboards with Objective C. How can i add more funcionality with swift by adding new storyboard with old?
AVPlayer sometimes fails to play video
NSURL works on initial load For AVPlayer but will not load on next run, why?
Type MyViewController does not conform to protocol 'STPPaymentContextDelegate'
NSBatchDeleteRequest in Swift 3 for iOS 10 only?
Must I wait for Alamofire to finish post request or is it all asynchronous

Categories

HOME
apache-spark
matlab
collections
lua
angular2-forms
azure-search
react-navigation
windows-runtime
payment-processing
wget
overloading
openframeworks
rebus
aar
factory-girl
image-gallery
beanstalkd
windows-applications
c-strings
robotium
grouping
spring-batch-admin
fat-free-framework
simple-html-dom
effects
codewarrior
reed-solomon
complex-networks
ollydbg
webcenter
doctrine-odm
nav
macvim
weebly
google-slides
qmenubar
azure-cdn
website-hosting
android-gps
formstack
ctl
masm32
android-sdk-tools
setwindowshookex
rsh
target-platform
storage-duration
samsung-gear
mailx
spatial-index
mks
reactive-cocoa-3
excel-charts
epoll
cpp-netlib
syndication-feed
zeroclipboard
angularjs-google-maps
fay
ducttape
apache-commons-dbcp
broadcom
polarssl
mms-gateway
asp.net-authentication
speaker
sizzle
hudson-plugins
haar-wavelet
applaud
oncreate
force.com
cellid
websolr
ember-router
data-oriented-design
ladon
measure
pastebin
regexbuddy
webshop
sqlitemanager
gendarme
resharper-4.5
docking

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App