01-11-2021, 06:33 PM
(This post was last modified: 01-11-2021, 06:34 PM by josemendez.)
(01-11-2021, 12:06 PM)linkinb Wrote: Hi,
I create ropes via script using the RopeBetweenTwoPoints.cs sample script.
Once the rope is generated, I want to be able to edit the blueprint to my liking and save the blueprint of the rope for future use.
The only problem is the blueprint is created using
var blueprint = ScriptableObject.CreateInstance<ObiRopeBlueprint>();
Now I can edit the rope in playmode but since the blueprint is an instance it doesn't get saved.
If I save the rope as a prefab the blueprint still dissapears.
I know I can manually create blueprints and edit them in the editor, but I intend to create 20+ ropes and it would be tedious to manually create each new rope and blueprint.
How can I save a rope as a prefab/save the rope's blueprint after it has been generated and edited in playmode?
Blueprints are just scriptable objects, so you can use CreateAsset the usual way in Unity:
https://docs.unity3d.com/ScriptReference...Asset.html
This will write your blueprint to disk, creating a file in your project that you can then use.