unity adding component to another gameobject
//referencing a gameobject
public GameObject exampleObject;
//===============================================================>
private Rigidbody rb; //example of a component
public void Awake() {
// adding a Rigidbody component to exampleObject
rb = exampleObject.AddComponent<Rigidbody>();
// referencing an existing Rigidbody component in exampleObject
rb = exampleObject.GetComponent<Rigidbody>();
}
Also in C#:
- how can convert string to int csharp
- how to convert object in string JSON c#
- unity set sprite transparency
- c# join string array
- c# new dictionary linq
- play animation through script unity
- unity to integer
- unity how to make a ui disappear
- wpf label text in center
- unity clamp rotation
- c# Authorization has been denied for this request
- isGrounded script for copy
- unity rb.addexplosionforce 2d
- reverse string c#
- c# linq to select even numbers
- how to reference a child object unity
- generic repository pattern c#
- JavaScriptSerializer() and convert to base64
- how to randomly rotate rigidbody of object in unity
- C# aspnet how to run a migration
- unity movement on forward
- iterate through xpdictionary devexpress
- c# select first value from list
- percentage in c#