using UnityEngine;
using System.Collections;
public class FallingBlockReset : MonoBehaviour {
public int maxYPosition = -1;
private Vector2 initialPos;
// Use this for initialization
void Start () {
initialPos = transform.position;
}
// Update is called once per frame
void Update () {
if( gameObject.transform.position.y <= maxYPosition)
{
transform.position = initialPos;
}
}
}
i made a litle script that resets my block when it fall down the problem is once it reset the platform will fall down forever in a loop and i dont want that i want it to fall down and then reset would be awsome if anyone had a solutions to my litle problem ty in advance
the way i make the block fall is by using a rigidibody2d and 2dboxcolider and setting the gravity on the rigidibody2d to 0 so the player will push it down when he/she stands on it