23-11-2021, 01:22 PM
(27-10-2020, 12:53 PM)josemendez Wrote: You're welcome! One final note though (you might know this already, but doesn't hurt to complete the info for future readers): I understand this script is editor-only, as you want to ship the game with all blueprints pre-made. If this script is not in a /Editor folder (like it should if it's an editor script), it will be included in any builds you make, and will result in compilation errors if using stuff from the UnityEditor namespace (as it's unavailable outside the editor). In that case you want to exclude any editor-only code by wrapping it in #if UNITY_EDITOR/#endif preprocessor directives. Like so:I get this error when I exit after saving. what is the reason?
Code:ObiRope actor = GetComponent<ObiRope>();
actor.SaveStateToBlueprint(actor.blueprint);
#if UNITY_EDITOR
EditorUtility.SetDirty(actor.blueprint);
AssetDatabase.SaveAssets();
#endif
This will exclude the two editor-only lines in case you're building the script to be shipped with the standalone build, and the blueprint will only be saved to memory.