예제 #1
0
    public IEnumerator BoxShapeComponentMissingValuesGetDefaultedOnUpdate()
    {
        string entityId = "1";

        TestHelpers.CreateSceneEntity(scene, entityId);

        // 1. Create component with non-default configs
        string componentJSON = JsonUtility.ToJson(new BoxShape.Model
        {
            withCollisions = true
        });

        string componentId = TestHelpers.CreateAndSetShape(scene, entityId, DCL.Models.CLASS_ID.BOX_SHAPE,
                                                           componentJSON
                                                           );

        BoxShape boxShapeComponent = (BoxShape)scene.GetSharedComponent(componentId);

        // 2. Check configured values
        Assert.IsTrue(boxShapeComponent.GetModel().withCollisions);

        // 3. Update component with missing values
        scene.SharedComponentUpdate(componentId, JsonUtility.ToJson(new BoxShape.Model {
        }));

        // 4. Check defaulted values
        Assert.IsTrue(boxShapeComponent.GetModel().withCollisions);
        yield break;
    }