When leaving a scriptableobject’s public string field empty I am unable to check this by ==“” or ==null. There is apparently “something” in that field even if its left untouched.
Should they just always have something written on them and compare that value as the placeholder “null”?
That’s not true at all. If you don’t touch it, it will be null.
[CreateAssetMenu]
public class SomeScriptable : ScriptableObject
{
public string SomeString;
private void OnEnable()
{
Debug.Log(SomeString == null); // Prints "True"
// This is better check for strings.
Debug.Log(string.IsNullOrEmpty(SomeString)); // Prints "True"
}
}
Maybe you’ve made mistake? If you’re sure about this, you can send bug repo to unity, because it’s not what should happen.