- Home /
The question is answered, right answer was accepted
Graph/function in editor
I have this asset published on the unity asset store. It handles the opening/closing of doors. Now I want to add functionality to this asset by putting 'graphs/functions' in the inspector under the settings of the door so a developer can make a door so that first the door would open/close slowly and then go faster and faster and then slow down again. Is there any possibility to add adjustable graphs/functions to the inspector that the user can adjust by like selecting points on the graph and then dragging it up or down. So that then the x-axis would represent time and the y-axis would represent speed. Thanks!
The graph should look something like this:
Asset: https://www.assetstore.unity3d.com/en/#!/content/38694
Answer by slippdouglas · Sep 10, 2015 at 03:14 PM
Put a public variable in your class with the type AnimationCurve:
public AnimationCurve myCurve;
You can evaluate the curve (get the y
for an x
value) with:
float y = this.myCurve.Evaluate(x);