Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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 :: add row count devepxress report 
Csharp :: joystock movement 
Csharp :: get width of image unity 
Csharp :: optimistic update 
Csharp :: how to start a webpage from a button c# 
Csharp :: hello world in unity c# 
Csharp :: wpf app how to get all elements 
Csharp :: average c# 
Csharp :: c# select oracle database 
Csharp :: coroutine start unity 
Csharp :: git find commits by file path 
Csharp :: unity pause game c# 
Csharp :: update multiple records with entity framework 
Csharp :: roman to number 
Csharp :: c# round double 
Csharp :: c# datagridview change selected row color 
Csharp :: Unity Interstitial ad C# 
Csharp :: c# ienumerable to list 
Csharp :: 2d list c# 
Csharp :: c# linq distinct group by nested list 
Csharp :: or in if statement c# 
Csharp :: sqldatareader in c# 
Csharp :: asp.net mvc image upload 
Csharp :: .net mvc return a specific View 
Csharp :: How to find out if a file exists in C# / .NET? 
Csharp :: c# how to check for internet connectivity 
Csharp :: group by ef core 
Csharp :: linq when name then orderby 
Csharp :: how to get file type from base64 in c# 
Csharp :: replace first occurrence of character in string c# 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =