-1
Good evening, I’m trying to take a function that be in another script and pass it to a button, only to be giving this error that be in the title.
int indice;
public Button Ant;
public ScriptName Script;
void Start() {
    call();
}
void call() {
    if (indice <= 0) { indice = 0; }
    if (indice >= 1) {
        indice = 1;
    }
    if (indice == 0)
    {
        Ant.GetComponent<ScriptName>().anteriorobj();//assim não funciona
        Ant.GetComponent<Script>().anteriorobj();//assim tambem não funcioa
    }
    else if (indice == 1)
    {
    //blablabla
    }
}
public class ScriptName : MonoBehaviour {
    public void anteriorobj()
    {
        Debug.Log("Active");
    }
So as being in the description, I wanted to take this function script.anteriorobj and set it on a button variable
– Nitecki