Different YAML Line wrapping in Unity vs UnityYAMLMerge

Does anyone know if it’s possible to stop unity from serializing strings over multiple lines in .asset files?

I have the following simple script:

using UnityEngine;

namespace DefaultNamespace
{
	[CreateAssetMenu(menuName = "Hello/Create")]
	public class teststring : ScriptableObject
	{
		public string test;
	}
}

And it produces output like this :

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 0}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 11500000, guid: 7ec26491b0f442ff89cadf7646cb4e59, type: 3}
  m_Name: New Teststring
  m_EditorClassIdentifier: 
  test: Hello, this is a long string which will go over multiple lines I hope.  I
    really need to see how serialization behaves for something like this.

I’ve tried setting ‘Serialize Inline Mappings On One Line’ in the Editor Settings but it doesn’t seem to have any effect.

The main issue is that it constantly changes the wrap point - so merging files like this can be an absolute nightmare.

After a bit more investigation, it seems that after a YAMLMerge, it changes the word wrapping on the files.

So something to do with that, I can only assume.

So as an example, this file is what unity will serialize:

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 0}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 11500000, guid: 61002b575d8440828fe4e0936c1d3850, type: 3}
  m_Name: en_StringLibrary
  m_EditorClassIdentifier: 
  GUID:
    m_data: f4963499c84f22b405c4ee219ae44e19
  Version: 0
  Entries:
    - UID:
        m_data: 4f15f1141e3676765d095c02046e5095
      Key: Content/Story/Townies/Generic/JoinTown01_02
      Value: But as this is a demo I'll just make it easy for you and start living
        here!
      Comment: null
      State: 0

But UnityYAMLMerge will output this :

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 0}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 11500000, guid: 61002b575d8440828fe4e0936c1d3850, type: 3}
  m_Name: en_StringLibrary
  m_EditorClassIdentifier: 
  GUID:
    m_data: f4963499c84f22b405c4ee219ae44e19
  Version: 0
  Entries:
    - UID:
        m_data: 4f15f1141e3676765d095c02046e5095
      Key: Content/Story/Townies/Generic/JoinTown01_02
      Value: But as this is a demo I'll just make it easy for you and start living here!
      Comment: null
      State: 0

Note the word ‘here’ in the ‘value’ field being pushed to the next line.

good coding nice

Make bug report on this :slight_smile: