unity freezes when opening script code example
Example: unity freeze position in script
using UnityEngine;
public class FreezePosition : MonoBehaviour
{
public GameObject TheThingToFreeze;
public void Start()
{
TheThingToFreeze.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;
}
}