Hi. I am making a game where if the player collides with a certain object they’re scale will change. How can I do this? Here’s how I set up the if statement: Now how can I change the scale of the player within that if statement?
using UnityEngine;
using System.Collections;
public class GetLonger : MonoBehaviour {
void OnCollisionEnter(Collision col){
if(col.gameObject.name == "Biggerer"{
}
}
}
Thank you so much, but how can I add on to the object's scale? For example if my cube's scale (1, 1, 1) how can I make in that scale + 1 one. So every time the player touches the object it will get longer.
– vincentamatoWhat i posted adds onto the current scale, hence += The vector3 describes which axis, x, y and z that you wish to add to and by what amount. if all 1's and you will scale uniformly, etc. you can also use the static [variables on the Vector3 class][1] [1]: http://docs.unity3d.com/ScriptReference/Vector3.html
– Landern