GetComponent method in unity to access component by C# script
In many case you have to access component attached with a gameObject then change its properties and value so here is a simple method of doing this Create a C# script and open it first declare a gameObject whose component you want to access. Then declare a component type to reference component for example if you want to access Image component declare Image or want to access AudioSource declare AudioSource. now you can call gameObject.GetComponent<Type>() method for referencing. using System . Collections ; using System . Collections . Generic ; using UnityEngine ; using UnityEngine . UI ; public class test : MonoBehaviour { public GameObject image_object; private Image my_image; void Start () { my_image = image_object . GetComponent < Image ...