change sprite of 2d object in code code example
Example 1: Check object is in layermask unity
public bool IsInLayerMask(GameObject obj, LayerMask layerMask)
{
return ((layerMask.value & (1 << obj.layer)) > 0);
}
Example 2: unity how to change text in script
Text myText = GameObject.Find("Canvas/Text").GetComponent<Text>();
myText.text = "Your text changed!";