Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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-***-*-*-*-*-*-
Comment

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
Comment

unity rigidbody2d disable

//you can't :(
//you can delete it with
Destroy(RigidBody2D);
Comment

disable rigidbody unity


 myPlayer.Getcomponent<Rigidbody>().isKenimatic == false;
 myPlayer.Getcomponent<Rigidbody().detectCollision = true;
 }

Comment

PREVIOUS NEXT
Code Example
Csharp :: unity reverse string 
Csharp :: unity random number 
Csharp :: change button color in script unity 
Csharp :: get enum value from display name c# 
Csharp :: get last element in a list vb.net 
Csharp :: linq where id in list 
Csharp :: convert string to int c# 
Csharp :: get type of variable c# 
Csharp :: c# move files from one directory to another 
Csharp :: unity how to move an object 
Csharp :: read all lines from txt c# 
Csharp :: asp.net c# set session timeout 
Csharp :: get last character of string c# 
Csharp :: prevent asp button from postback 
Csharp :: Throw index out of range C# 
Csharp :: how to make colliders collide with some things but not other in unity 
Csharp :: c# get list of all class fields 
Csharp :: binary search c# 
Csharp :: c# read lines number 3 from string 
Csharp :: unity pause game c# 
Csharp :: array sorting c# 
Csharp :: unity print vs debug log 
Csharp :: c# console print 
Csharp :: how to cap rigidbody velocity 
Csharp :: creating a streamwiter file C# 
Csharp :: qtablewidget add image 
Csharp :: nunjucks index in loop 
Csharp :: constructor c# 
Csharp :: c# char 
Csharp :: c# public static string 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =