In my project I'm trying to store an ARMeshAnchor into UserdDefaluts converting it to Data. I'm unable to find a solution.
This one of my errors
Instance method encode(_:forKey:)
requires that ARMeshAnchor
conform to Encodable
.
Maybe it is better to convert them to an SCNNode and try to convert the node to Data?
Thanks
For this you should use
NSKeyedArchiver
class and your code might look like this:And remember in RealityKit there's also a scene object where anchors' collection is located: