I have an app using SpriteKit, which transitions between different Scenes on user input. I have defined all Scenes in separate .sks
files and each contains a Sprite with a transition SKAction (AnimateWithTextures
Action from within the Object Library).
What I want to do, is to enable the user to set the transition duration in settings. For this, I need access to the SKAction from the scene, but can't seem to find a way to access it programmatically. I know I can set a key when running an action from code with run: withKey:
, but can I set this key from within Scene Editor?
If you are placing Actions onto the SKScene file, then it will fire at the timeline provided, you will not be able to grab and hold it. But what you can do, is on the timeline table in your scene file, is do CMD + click on your desired action. and save it as a reference. This will create an sks file that will house your actions.
Now that you have the actions in an action file, you can use SKAction(named:"actionname")
to pull it out.
If it is an action you are going to be using over and over, I would recommend storing this into a variable, and just calling the variable when needed.