Hello guys.
I have a problem that I can’t solve, even after trying to find the solution myself and with similar topics.
// First script
public void CreateNewCard(string aName, ?? method(someParameters)) {
// Do something
}
public void Method1(string someText, int someValue, float number) {
// Do something
}
public void Method2(int anotherValue, int something) {
// Do something
}
// Second script
GetComponent<FirstScript>().CreateNewCard("Name", GetComponent<FirstScript>().Method1("Text", 5, 1.5f));
GetComponent<FirstScript>().CreateNewCard("Name2", GetComponent<FirstScript>().Method2(4, 3.7f));
As you can see, i want to use differents methods with differents number and type of parameters as argument, because I want to store a method in new objects (here it’s cards), so those cards can use the method later. But I don’t know how (I can’t with delegate or Action because of the differents number and type of parameters).
I don’t want to create prefab with the script + method on it, because i can have more than 1000 types of card, and i don’t to have so much prefab.
Thanks for the help, and sorry for my english, it’s not my native language !