Answers for "add node to frame from diffrent class swift"

0

add node to frame from diffrent class swift

/*

You need to get the current instance of the game scene 
in order to add children to it. GameScene() is just the 
method that initializes a new scene, but has nothing to do 
with the current scene that you are using.

Instead, you could go back to the place where it was 
initialized (likely in the View Controller) and initialize 
your other class in there (the one you want to add children 
from). Change the constructor so that you can pass in that 
instance of the GameScene and keep it as like a 
property/variable of the class that you want to call from. 
Then, use it like a variables and add all the children you 
want.

*/
Posted by: Guest on March-21-2020

Code answers related to "add node to frame from diffrent class swift"

Code answers related to "Swift"

Browse Popular Code Answers by Language