unity onclick addlistener
public int index;
private Button myselfButton;
void Start()
{
myselfButton = GetComponent<Button>();
myselfButton.onClick.AddListener(() => actionToMaterial(index));
}
void actionToMaterial(int idx)
{
Debug.Log("change material to HIT on material : " + idx);
}
void Destroy()
{
myselfButton.onClick.RemoveListener(() => actionToMaterial(index));
}
Also in C#:
- how to make a datatable in c#
- .net core executenonqueryasync transaction
- unity get scrollbar value
- load scene unity
- how to make error sound c#
- c# copy file
- wpf binding ancestor codebehind
- native-googlesignin configuration is null!?
- rotatearound unity
- C# invoke
- console application in c# ms crm
- double tryparse dot comma
- uncaught syntaxerror invalid or unexpected token unity webgl
- create expression func c# for use in where clause
- lat long data type c#
- c# make request to rest api
- attribute usage c#
- c# create a text file
- resize image c#
- set decimal point c#
- how to trigger event when a com device is connected in c#
- pass parameter to thread c#
- uwp roaming data sample
- validating file upload asp.net core mvc