浏览代码

Fixed Spawn Prefab initial transform so the values can be get in Awake

/main
Thomas ICHÉ 6 年前
当前提交
d9125d87
共有 1 个文件被更改,包括 10 次插入3 次删除
  1. 13
      Runtime/Actions/SpawnPrefabAction.cs

13
Runtime/Actions/SpawnPrefabAction.cs


foreach (var prefab in Prefabs)
{
string name = prefab.name;
var obj = Instantiate<GameObject>(prefab);
Vector3 position = gameObject.transform.position;
Quaternion rotation = gameObject.transform.rotation;
if(TargetTransform != null)
{
position = TargetTransform.position;
rotation = TargetTransform.rotation;
}
var obj = Instantiate<GameObject>(prefab, position, rotation);
obj.transform.position = TargetTransform.position;
obj.transform.rotation = TargetTransform.rotation;
if (AttachToTarget)
obj.transform.parent = TargetTransform;

正在加载...
取消
保存