Issue #5968: fixed a bug of cc.Layer that its bake function doesn't work

Fixed a bug of cc.Layer that its bake function doesn't work