浏览代码

Update ScenarioSerializer.cs

/0.9.0.preview.1_staging
Aryan Mann 3 年前
当前提交
35c23b63
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 4
      com.unity.perception/Runtime/Randomization/Scenarios/Serialization/ScenarioSerializer.cs

4
com.unity.perception/Runtime/Randomization/Scenarios/Serialization/ScenarioSerializer.cs


if (rangeAttribute != null)
{
if (readScalar.Item2 != null &&
(Math.Abs(rangeAttribute.min - readScalar.Item2.max) > tolerance || Math.Abs(rangeAttribute.max - readScalar.Item2.max) > tolerance))
(Math.Abs(rangeAttribute.min - readScalar.Item2.min) > tolerance || Math.Abs(rangeAttribute.max - readScalar.Item2.max) > tolerance))
{
//the field has a range attribute and the json has a limits block for this field, but the numbers don't match
Debug.LogError($"The limits provided in the Scenario JSON for the field \"{field.Name}\" of \"{obj.GetType().Name}\" do not match this field's range set in the code. Ranges for scalar fields can only be set in code using the Range attribute and not from the Scenario JSON.");

if (readScalar.Item2 != null)
//the field does not have a range attribute but the json has a limits block for this field
Debug.LogError($"The provided Scenario JSON specifies limits for the field \"{field.Name}\" of \"{obj.GetType().Name}\", but the field has no Range attribute in code. Ranges for scalar fields can only be set in code using the Range attribute and not from the Scenario JSON.");
field.SetValue(obj, Convert.ChangeType(readScalar.Item1, field.FieldType));
}
}

正在加载...
取消
保存