I’m having an issue with the editor serialization, where the resulting YAML does not put quotes around a string, causing unicode not to work on device push notifications.
Basically what I’ve observed is this:
If I copy and paste an emoji into the editor string field, it pastes as an invisible character with no character width. This will properly serialize into unicode, and the string will be surrounded by quotes. This works on device.
"This is only a test. \U0001F3F0\U0001F622" (two copied and pasted emoji, as invisible characters in the string field)
However, if I then manually type the unicode in so that I can see it in editor, the resulting YAML will not have quotes around it, and it will not work on device.
This is only a test. \U0001F3F0\U0001F622 (manually typed, or copied from the prior YAML)
What is controlling whether or not the resulting YAML string is quoted, and/or whether certain characters are automatically escaped?
Is there an elegant way to control the yaml output?
Perhaps one way might be to add an extra linefeed at the end? Pretty sure that forces quotes too.
I would not call either of those “elegant” however. Yuck.
The best way to maintain control is probably by using a TMP_SpriteAsset and doing your own embedded sprites within your text, but obviously it would be tricky to digest ad-hoc text you get off the net this way.
Thanks for the suggestions, I am testing out a similar solution with adding a special invisible character like linefeed or whitespace etc OnBeforeSerialize, and then OnAfterDeserialize removing it along with any automagically added double-slashes.
Bearing in mind that this text will be used as a local notification, is the TMP approach possible? My understanding was that the notifications will use the device native font, and wouldn’t be able to get textures from my assets.