Game -> Editor. copy to clipboard? file + editor-script?

This is what I want to do:
A script records parts of what happens in a game (running in the editor) and saves it into an array of a script on a prefab - the values should persist beyond stopping of the game…

A few ideas how this could work:

  • Can I somehow make the game copy values into the clipboard? then I could just paste them into a script file… - Is there a way access variables of a script in the Inspector from an Editor-script?
  • Write a file and read that - currently my favorite because I could actually get that done…

Any other ideas? All help is very much appreciated…

yay! I think I found a way!

If I Resource.Load() a script that I have on a prefab in the Resources Folder without instantiating it, I can then write my values in there and they persist even when I stop the game!

This saves me gazillion billion million hours of mindless copy/pasting. yay!

var AI : AI = Resources.Load("AI", AI);
AI.pos[0] = transform.position;

2 years later, a little afterthought: I think I had to do EditorUtility.SetDirty(AI); so the changes wouldn’t vanish eventually…

Copy/Pasting can be done with EditorGUIUtility.systemCopyBuffer

Thanks a lot for the update and the 2 years later afterthought: I was looking exactly for this info :slight_smile: