Hi !
here I would like to ask about transform.parent.
public GameObject enemyPrefab;
void Start () {
GameObject enemy1 = Instantiate(enemyPrefab, new Vector3(0,0,0), Quaternion.identity) as GameObject;
enemy1.transform.parent = transform;
}
}
from script above,
GameObject enemy1 = Instantiate(enemyPrefab, new Vector3(0,0,0), Quaternion.identity) as GameObject;
// Instantiate enemyPrefab from my Prefab assets folder by putting my prefab enemy sprite to the GameObject slot on Inspector and we declare that as name enemy1 which is GameObject type and we make that as a GameObject?
enemy1.transform.parent = transform;
// enemy1 's parent which is currently EnemyFormation(Because we attached the prefab which then became gameobject(enemy1) 's position becomes the position(transform) of enemy1 ??
this part, I am bit confused. Please correct my description above if it is wrong. Thank you!