由于某些原因,我需要替换Hierarchy下某个GameObject,如果是直接DestroyImmediate后再Instantiate的话,新创建的GameObject是直接放置在最后的(同一个父节点的情况下)
Unity提供了GetSiblingIndex函数获取位置
var index = transform.GetSiblingIndex();
如果需要替换原来的位置
newObj.transform.SetSiblingIndex(index);
Index就是位置的index,
eg:
// 置顶
newObj.transform.SetSiblingIndex(0);
PREVIOUSunreal自动化打包
NEXTUE打包环境配置