- Home /
Question by
Jotakuun · Dec 03, 2014 at 07:35 PM ·
instantiateprefabscale
Instantiate prefabs scaled
Hello Unity Community!
I have a function instantiating a prefab and I want to do another function with same instantiate but in x scale -1. I don't know how to do it, can someone help me? Thanks.
function AttackX (){
Instantiate(attackXeffect, Vector3(playerXpos +1.2, playerYpos, playerZpos), Quaternion.identity);
transform.position += Vector3.right * 5 * Time.deltaTime;
}
function AttackXleft (){
Instantiate(attackXeffect, Vector3(playerXpos +1.2, playerYpos, playerZpos), Quaternion.identity);
transform.position -= Vector3.right * 5 * Time.deltaTime;
}
Comment
Best Answer
Answer by Cherno · Dec 03, 2014 at 08:10 PM
You can just change the transform.localScale after instantiating, exactly like you did with the transform.position.
transform.localScale.x = -1;