[請益] unity中gameobject改parent後顯示問題
(已解決)
目前再作背包欄跟裝備欄的部分,
想要如果再裝備欄A已經裝備了物品a,
那再拖曳其他物品到裝備欄A時,物品a會被丟回背包欄。
一開始在ItemStroage_Grid(背包)產生三個itemSlot(物品)
http://imgur.com/a/WiFWo
拖曳itemSlot0 (物品a)到裝備欄Eq01_Grid(裝備欄A)。
http://imgur.com/a/8FiJg
再拖曳itemSlot1 (物品b)到裝備欄 Eq01_Grid (裝備欄A),想要把前一個裝備
(itemSlot0 物品a)丟回ItemStroage_Grid (背包)
http://imgur.com/a/KFAxY
在Hierarchy可以看到itemSlot0已經變成ItemStroage_Grid的child.
右邊也顯示他的位置在ItemStroage_Grid裡面,可是圖顯示不出來,
也無法在對itemSlot點擊拖曳等動作。
變換parent我是這樣寫的
NGUITools.FindInParents<UIGrid(gameObject).transform.GetChild(0).
SetParent(GameObject.Find("ItemStroage_Grid").transform);
此時的gameObject="itemSlot1",我是先找他的parent "Eq01_Grid",
再找Eq01_Grid的第一個child "itemSlot0",再改變itemSlot0的parent。
請問這樣可能是哪邊出了問題呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.116.164.175
※ 文章網址: https://www.ptt.cc/bbs/GameDesign/M.1469431469.A.29B.html
推
07/25 18:36, , 1F
07/25 18:36, 1F
推
07/25 18:46, , 2F
07/25 18:46, 2F
→
07/25 20:44, , 3F
07/25 20:44, 3F
→
07/25 20:45, , 4F
07/25 20:45, 4F
→
07/25 20:46, , 5F
07/25 20:46, 5F
推
07/25 20:56, , 6F
07/25 20:56, 6F
→
07/25 20:58, , 7F
07/25 20:58, 7F
→
07/25 20:58, , 8F
07/25 20:58, 8F
→
07/25 21:02, , 9F
07/25 21:02, 9F
→
07/25 21:03, , 10F
07/25 21:03, 10F
→
07/25 21:05, , 11F
07/25 21:05, 11F
→
07/25 21:07, , 12F
07/25 21:07, 12F
→
07/25 21:08, , 13F
07/25 21:08, 13F
→
07/25 21:13, , 14F
07/25 21:13, 14F
→
07/25 21:14, , 15F
07/25 21:14, 15F
→
07/25 21:15, , 16F
07/25 21:15, 16F
→
07/25 21:17, , 17F
07/25 21:17, 17F
→
07/25 21:18, , 18F
07/25 21:18, 18F
→
07/25 21:20, , 19F
07/25 21:20, 19F
→
07/25 21:20, , 20F
07/25 21:20, 20F
→
07/25 21:21, , 21F
07/25 21:21, 21F
→
07/25 21:24, , 22F
07/25 21:24, 22F
→
07/25 21:25, , 23F
07/25 21:25, 23F
※ 編輯: yabibear (140.116.164.175), 07/25/2016 21:29:14
GameDesign 近期熱門文章
PTT遊戲區 即時熱門文章