Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity button press onclick click add C#

using UnityEngine;
using UnityEngine.UI;

public class Example : MonoBehaviour
{
	[SerializeField]
    private Button button;
    
    void Start()
    {
    	button.onClick.AddListener(RunThisTask);
    }
    
    void RunThisTask(){
    	//do something
    }
}
Comment

unity button onclick

GetComponent<Button>().onClick.AddListener(()=>print("clicked"));
Comment

unity onclick object


using UnityEngine;
using System.Collections;

public class Click : MonoBehaviour {

    public GameObject gameObjectToClick;
    void OnClick(){
         gameObjectToClick.SpecialFunction(); //call special function you wanted to call
    }
}

Comment

PREVIOUS NEXT
Code Example
Csharp :: how to import datagridview to datatable in c# 
Csharp :: c sharp thread lambda 
Csharp :: function on animation exit unity 
Csharp :: what is type unity 
Csharp :: unity action example 
Csharp :: HOW TO RETURN CELL VALUE FROM EXCEL IN C# 
Csharp :: unity 3d camera movement script 
Csharp :: lock pc using c# 
Csharp :: remove all non alphabetic characters from string c# 
Csharp :: asp.net core get previouse url 
Csharp :: route attribute controller with parameter asp.net core 
Csharp :: Convert array of strings to List<string 
Csharp :: how to get specific length of row in matrix c# 
Csharp :: .net core check if linux 
Csharp :: fluent assertion exception 
Csharp :: how to create empty text file in c# 
Csharp :: c# multi assignment 
Csharp :: unity check gameobject active 
Csharp :: dotnet core 3.1 get the user that just logged in 
Csharp :: website link c# 
Csharp :: c# array.join 
Csharp :: unity check if camera can see object 
Csharp :: mvc write to console 
Csharp :: sort file name with C# 
Csharp :: c# get custom attribute from property 
Csharp :: while c# 
Csharp :: make variables in c# 
Csharp :: C# select keyword lambda 
Csharp :: how to skip bin/Debug/netcoreapp3.1/ on the reltaive path 
Csharp :: char array 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =