Harshil.Chokshi
Harshil.Chokshi

Reputation: 681

What methods do I need in custom scene class of Scenekit ios?

I have created a custom class called ScoreBoardScene that inherits from SCNScene. in the .m file I have a method that adds all the geometry to the scene called -(void)createScene. Now where do I call createScene? Like is there a certain init method? Also according to this tutorial I need to have a nscoder method as well. So what are the two methods I need to complete the sceneview class besides all the custom methods I have?

Upvotes: 0

Views: 471

Answers (1)

Hal Mueller
Hal Mueller

Reputation: 7646

Don't subclass SCNScene.

Instead, your createScene method (perhaps implemented in an Objective-C category on SCNNode) should return an SCNNode which is the root node of your scene.

For even better startup performance, you can run createScene once, in an auxiliary program, and then archive the scene. The archived scene can then be embedded as a resource in your final product, and even tweaked using the SceneKit editor in Xcode..

Upvotes: 2

Related Questions