Inspector Graph is a tool for drawing a mathematical function as a property in the inspector.
This tool is open source.
- Unity 2021.2 and up.
To use this in your project, you have to download the repository and place it anywhere in the "Assets" folder.
Then, in any Monobehaviour script, connect the "InspectorGraph" namespace and inherit from "IFunction".
Don't forget to define the "GetFunctionValue" method in which you should specify your mathematical function.
Then define the "Graph" field. You may not initialize it, but it must be public or marked with the "[SerializeField]" attribute.
The place where the graph is displayed depends on the location of the "Graph" field.
See here.