- Home /
Why won't my function show up in the onClick area of a button?
Ok so i have this code script. it is a simple enable script...
public void otherstuff(List objsToBeTurnedoff,List objsToBeTurnedOn){
foreach(GameObject a in objsToBeTurnedOn)
{
a.SetActive(true);
}
foreach(GameObject a in objsToBeTurnedOn)
{
a.SetActive(false);
}
}
When I put this in a script...
It will not show...
Answer by DiegoSLTS · May 22, 2015 at 12:30 PM
The only functions that will appear there are public functions that return void and takes 0 or 1 parameter, and the parameter should be an int, float, bool, string or UnityEngine.Object.
So, you can't use a function that takes 2 List parameters.
Exactly what I was looking for. However, could not find this documented in the Unity manual or script reference. If you know where it is, please share a link.
Answer by flashmandv · May 15, 2016 at 01:35 PM
I had similar problem. In my case it was because of compile error in the code Make sure to check this if nothing else helps
Your answer
![](https://koobas.hobune.stream/wayback/20220613200149im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to modify a button component with C# 0 Answers
My Function is not showing up in the OnClick Menu 2017.2.0f 0 Answers
issue rendering animation on button click 1 Answer
Press button on canvas to transform prefab clone? 0 Answers
Buttons sounds are only playing once, then the sound no longer plays? 0 Answers