Answers for "unity force stop"

2

unity how to stop the game

The most convenient method for pausing the game in Unity is by setting the game’s time scale to zero (Time.timeScale = 0), which effectively pauses all time based operations including movement, physics and animation. Setting the time scale to one again will return the game to its normal speed.
Posted by: Guest on June-30-2021
0

remove force unity

using UnityEngine;

public class MyObject : MonoBehaviour
{
	private RigidBody m_rb;
    
    void Start()
    {
    	m_rb = GetComponent<RigidBody>();
    }
    
    // Do it in FixedUpdate() if it's triggered by physics (collision-based for
    // example), Update() otherwise.
    void FixedUpdate()
    {
    	if(yourCondition)
        {
        	m_rb.velocity = Vector3.zero;
        }
    }
}
Posted by: Guest on April-29-2021

Browse Popular Code Answers by Language