Horje
how to disable and enable rigidbody unity Code Example
how to disable and enable rigidbody unity
// if you want to disable the rigidbody on which the script is sitting on
// you can't do that but you can go around it by 

// Just destroying the rigidbody by calling
Destroy(gameObject.GetComponent<Rigidbody>());

// and if you want it again call
gameObject.AddComponent<Rigidbody>();

// Remember "gameObject" with small 'g' reffers to the gameObj on which the script
// is sitting on

// -*-*-*-*-*-***-HAPPY CODING-***-*-*-*-*-*-
disable rigidbody unity
//This is for Unity (c#)
Rigidbody rb; //For 2D games use 'Rigidbody2D'
  
  void Awake ()
  {
      rb = GetComponent<Rigidbody>();
  }

  // (...)
rb.bodyType = RigidbodyType2D.Static;  // Deactivated
rb.bodyType = RigidbodyType2D./*The type the rigidbody was originally eg. dynamic, kinematic, or static*/; // Activated




Csharp

Related
movement script c# Code Example movement script c# Code Example
unity create scriptableobject asset Code Example unity create scriptableobject asset Code Example
unity createassetmenu Code Example unity createassetmenu Code Example
how to disable a gameObject unity c# Code Example how to disable a gameObject unity c# Code Example
random bool c# Code Example random bool c# Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8