Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity gameobject.getcomponent

rb = GetComponent<Rigidbody>();    
Comment

getcomponent unity

GameObject.GetComponent</*Component name */>();
Comment

unity GetComponent

using UnityEngine;
using System.Collections;

public class YetAnotherScript : MonoBehaviour
{
    //Create Object which get component from other Object
    //Put script and object 
    //enter Playmode to test component
    public GameObject objectToFind;

    public AudioSource audioSource;
    private void Start()
    {
        audioSource = objectToFind.GetComponent<AudioSource>();
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# xml comment type reference 
Csharp :: c# draw rectangle on screen 
Csharp :: disabling a button if textbox is empty c# 
Csharp :: c# add key value pair to dictionary 
Csharp :: C# Bitwise Right Shift 
Csharp :: C# trim trailing zero 
Csharp :: c# show list in richtextbox 
Csharp :: c# linq to select even numbers 
Csharp :: c# dictionary get key by value 
Csharp :: c# delete files 
Csharp :: migrationbuilder insert data example 
Csharp :: c# datetime remove days 
Csharp :: expansion tile 
Csharp :: how to add data in list in c# 
Csharp :: ??= mean C# 
Csharp :: c# substring reverse 
Csharp :: c# destroy function...unity 
Csharp :: async await c# 
Csharp :: Save object to file C# 
Csharp :: csharp bubble sort 
Csharp :: setting the parent of a transform which resides in a prefab 
Csharp :: Why Duplicate "..TargetFrameworkAttribute" c# assemblies created 
Csharp :: batchblock timeout 
Csharp :: telerik mvc grid column with icon 
Csharp :: unity DOScale 
Csharp :: declarar lista c# 
Csharp :: C# check if object is default 
Csharp :: c# loop through queue 
Csharp :: discord embeds how to separate inline fields 
Csharp :: c# streamreader to file 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =