public float velocidad = 1f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
rigidbody2D.velocity = new Vector2(velocidad, rigidbody2D.velocity.y);
}
}
is there any way to do a similar code for move, but without the rigidbody? becouse that slows a lot the game
Adding rigidbody component to a gameObject will help it to behave under Unity’s Physics engine like it will be under influence of gravity ,you can add force ,velocity etc.
But without rigidbody you can’t implement physics on that gameobject , but still you can move it from one position to other by changing its position by accessing its transform component if moving prefab is the only purpose here.
Hope I made it clear.