当我实例化我的预制件时
copyOfSpellObject = (GameObject)Instantiate(gameObject, transform.position, transform.rotation);
Item_Spell itemSpell = copyOfSpellObject.GetComponent<Item_Spell>();
itemSpell.SpellObject = GetComponent<Item_Spell>().SpellObject;
copyOfSpellObject.transform.SetParent(transform, false);
copyOfSpellObject.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(transform.position.x, transform.position.y, 0));
copyOfSpellObject.transform.SetParent(transform.parent.parent.parent, false);
它变得超大
正常 - http://prntscr.com/btgzg7
这是为什么 ?只有当我将游戏对象作为一个孩子放到特定的父母身上时才会出现问题,更具体地说,这个问题之后的每个父母都会导致问题,包括这个 transform.parent.parent.parent
.
1 回答
实例化后,单击层次结构中的对象 . 你看到'scale'属性中的任何大数字(在转换组件中)?如果您这样做,请尝试将这些数字全部设置为1并查看是否符合您的要求 . 然后在代码中将对象的比例设置为1(或任何你喜欢的大小),如下所示:
当为最初在没有父项的情况下创建的实例化对象生成父项时,转换往往变得非常奇怪 .
如果这有帮助,请告诉我