Graph Throw on a curve

Something cool I found out recently.

public AnimationCurve plot = new AnimationCurve();

void update () {
     float horizontalThrow = CrossPlatformInputManager.GetAxis("Horizontal");
     plot.AddKey(Time.realtimeSinceStartup, horizontalThrow);

That will output a graph during runtime. Very usefull for getting visual feedback on a variable.

unity%20-%204_Geometry_Attack%20-%20PC%2C%20Mac%20%26%20Linux%20Standalone%20_DX11_%201_24_2019%2010_18_04%20AM

I just tried the code you posted the game is not showing me any graph like you said it would. How did you get it to display the graph? It seems you need more then the code above.

Edit: I found the graph in the Inspector window of the space ship object. I had added the code to the Player script of my space ship object and Plot is one of the public variables there although you need to manually refresh the window to get the plot curve to change.

yeah, it only shows the graph while the game is running, and you have to click on it in the inspector to see it.

Privacy & Terms