Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How to Save / Load Obi Actors in 5.0
#18
(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:

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.
I get this error when I exit after saving. what is the reason?


Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
RE: How to Save / Load Obi Actors in 5.0 - by greyhawk - 23-11-2021, 01:22 PM