Are Document UserStrings persisted?

I want to persist some settings and am using SetUserString Key-Value pairs.

Are they persisted in the 3dm file?

If not, can you point me at how to persist them.

They should be. And it is easily tested…

If they (user strings) are attached to objects that serialize, yes.

I’m doing RhinoApp().ActiveDoc()->SetUserString(key, value) which works fine in that:

RhinoApp().ActiveDoc()->GetUserString(key) retrieves the correct values.

But if I save the file, exit and load it again, the changes are lost.

Solved. Was checking for keys OnNewDocument() rather than OnEndOpenDocument()

Thanks guys.

On a related note, I set a UserString() on CRhinoLight objects and they persist during the session, but if I save the 3dm and reload, they’re gone!

I was assuming CRhinoLight objects are serialized. Are they?