瀏覽代碼

修复红叉bug

baowen 2 天之前
父節點
當前提交
37d33ab8a2
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      assets/hall/script/BaseZhaocha.ts

+ 5 - 4
assets/hall/script/BaseZhaocha.ts

@@ -90,11 +90,12 @@ export class BaseZhaocha extends Component {
                 let scpos = event.getLocation()
                 let wopos = this.cam.screenToWorld(new Vec3(scpos.x, scpos.y, 0))
                 // let localpos = this.arr_node_allitem[0].parent.getComponent(UITransform).convertToNodeSpaceAR(new Vec3(worldpos.x, worldpos.y))
-                let localPos1 = this.cam.convertToUINode(wopos,this.arr_node_allitem[0].parent)
-                let localpos = new Vec3(localPos1.x,localPos1.y)
-                LayerMgr.instance.ShowPrefab(BundleName.hall, "prefab/x", (node) => {
+                // let localPos1 = this.cam.convertToUINode(wopos,this.arr_node_allitem[0].parent)
+                // let localpos = new Vec3(localPos1.x,localPos1.y)
+                LayerMgr.instance.ShowPrefab(BundleName.hall, "prefab/x", (node:Node) => {
+
                     node.parent = this.arr_node_allitem[0].parent
-                    node.setPosition(localpos)
+                    node.setWorldPosition(wopos)
                     this.scheduleOnce(() => {
                         node?.destroy()
                     }, 0.3)