Posts

Post not yet marked as solved
3 Replies
666 Views
HelloI'm a complete noob in Swift and RealityKit so I apologize if it's too basic.I'm getting a runtime error when I try to add my entity to the anchor. EXC_BAD_ACCESS and "No storage has been registered for component type 4937111887299015975(i1.CardComponent)" in the log.Attached a snippet of the codeThanks a lot !import UIKit import RealityKit class ViewController: UIViewController { @IBOutlet var arView: ARView! let anchor = AnchorEntity(plane: .horizontal) override func viewDidLoad() { super.viewDidLoad() arView.scene.addAnchor(anchor) let bottom = CustomBox.init() anchor.addChild(bottom) } } class CustomBox: Entity, HasModel, HasCollision { required init() { super.init() self.components[ModelComponent] = ModelComponent( mesh: .generateBox(size: [0.1, 0.01, 0.1]), materials: [SimpleMaterial(color: UIColor.gray, isMetallic: false)] ) self.components[CardComponent] = CardComponent() } } struct CardComponent: Component, Codable { var revealed = false }
Posted
by ori.rdt.
Last updated
.