sceneview-android
sceneview-android copied to clipboard
ViewNode - Rendering problem for the second time
val viewNode = ViewNode(
engine = sceneView.engine,
modelLoader = sceneView.modelLoader,
viewAttachmentManager = viewAttachmentManager,
).apply {
disable()
scale = Scale(-5f, 5f, 1f)
}
viewNode
.loadView(
context = this@ARActivity,
layoutResId = R.layout.tracker_ar_view,
onLoaded = { _, view ->
anchorNode.addChildNode(viewNode)
// Remove duplicates
val index = sceneView.childNodes.indexOfFirst { it.name == DESTINATION_NODE_NAME }
if (index != -1) sceneView.removeChildNode(sceneView.childNodes[index])
sceneView.addChildNode(anchorNode)
destinationNode = anchorNode
},
onError = {
}
)
I have this code for rendering XML view, when I enter this screen for the first time everything works ok, however after the 2nd time I enter the screen I get an error.