Is their a way to use a "tool" script to create a variable and save the variable in a scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Hubber116sx

I have a way to generate a level’s terrain polygon from a single line, but the process to bake the terrain is time consuming and wouldn’t be effective to do in-game at real time. What I want to do is, while in the editor, run the code that creates the terrain polygon, then save that polygon in the packed scene to use when the scene is loaded. That way when loading the level’s terrain I don’t have to recreate the polygon, but instead load the points in the polygon.

Is there a way to save variables in a scene?