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 createassetmenu 
Csharp :: unity check for internet connection 
Csharp :: hex string to int c# 
Csharp :: c# delete files older than x months 
Csharp :: how to get delta time in monogame 
Csharp :: c# get unix timespan 
Csharp :: stop program event in unity code 
Csharp :: rigidbody2d unfreeze position 
Csharp :: pause audio unity 
Csharp :: how to change a image with code unity 
Csharp :: detecting a right click unity 
Csharp :: asp.net core get request ip address 
Csharp :: stream to byte array c# 
Csharp :: unity add component 
Csharp :: cannot convert string to long c# 
Csharp :: unity check when clicked on object 
Csharp :: convert array from string to int c# 
Csharp :: c# replace string case insensitive 
Csharp :: random number generator c# 
Csharp :: playerInputManager.JoinPlayer(....) 
Csharp :: unity game sleep on hit 
Csharp :: console.writeline 
Csharp :: c# change colour of console 
Csharp :: iterate through dictionary c# 
Csharp :: c# create datatable 
Csharp :: C# socket bind to dns name 
Csharp :: how to make a quit button in unity 
Csharp :: index in foreach c# 
Csharp :: check if network is available c# 
Csharp :: c sharp check if key in dictionary 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =