I'm trying to make a moddingAPI for my Unity game, and I stumbled upon a question I can't really find an answer to. Let me explain:
I have a specific function in my Unity project, let's name it exampleFunction()
using moddingAPI;
public class exampleClass : MonoBehaviour
{
public static void exampleFunction()
{
//stuff
}
}
How can I call this function with my moddingAPI, if modders want to call it?
I know that the modder would have to write something like:
using moddingAPI;
public void callModdingAPI()
{
moddingAPI.moddingClass.callExampleFunction();
}
And the moddingAPI class library would include this:
using ???????;
public class moddingClass : MonoBehaviour
{
public static void callExampleFunction()
{
//how do I get the reference to "exampleClass"?
exampleClass.exampleFunction();
}
}
⬆ And this part is where my question is.
I'm currently creating the moddingAPI with a brand new class library with nothing imported (.NET Framework if it is important).
I don't have a direct reference to the exampleClass that is in my Unity game, so this code wouldn't work, and I don't know how to get this reference. Do I have to import something? Do I have to build something? What do I have to do? Thanks in advance.