ccc 2.0.10版本 在真机上fps掉了一半

  • Creator 版本:2.0.10

  • 目标平台: IOS

  • 详细报错信息,包含调用堆栈:无

  • 重现方式:无

  • 之前哪个版本是正常的 :

  • 手机型号 : iPhone XR

  • 手机浏览器 :微信 和safari

  • 编辑器操作系统 :Mac

  • 编辑器之前是否有其它报错 :

  • 出现概率:百分百

  • 额外线索:

在ccc 模仿一个 h5专题 , 然后在 浏览器上是60左右的fps 很正常 但是 一到真机上 就直接降了一半 就在30左右。
代码也不是很复杂就是 两个按钮 长按会让camera 移动 代码我放一下

cc.Class({
  extends: cc.Component,

  properties: {
    forwardButton: {
      default: null,
      type: cc.Node
    },
    backwardButton: {
      default: null,
      type: cc.Node
    },
    camera: {
      default: null,
      type: cc.Node
    },
    sceneContainer: {
      default: null,
      type: cc.Node
    },
    startForward: false,
    startBackward: false,

  },

  // LIFE-CYCLE CALLBACKS:

  // onLoad () {},

  start() {
    this.forwardButton.on('touchstart', function (e) {
      this.startForward = true
    }.bind(this))
    this.forwardButton.on('touchend', function () {
      this.startForward = false
    }.bind(this))
    this.backwardButton.on('touchstart', function (e) {

      this.startBackward = true
    }.bind(this))
    this.backwardButton.on('touchend', function () {
      this.startBackward = false
    }.bind(this))
    this.sceneContainer.getChildByName('Scene1').getChildByName('eagle').on('touchstart', function () {
      // modal.show(`Here is an eagle`, this.cancle, this.confirm)

    }.bind(this))



  },
  confirm() {
    console.info('outside tap')
  },
  cancle() {
    console.info('outside tap')
  },

  update(dt) {
    let vy = 100, zy = .1
    let sy = vy * dt


    if (this.startForward) {
      if (this.camera.y > -750) {
        this.camera.y -= sy
      } else {
        this.camera.y = -750
        // if (this.sceneContainer.children[1].scaleX <= 2) {
        //   const sceneCoordinate = this.sceneContainer.children[1].getChildByName('window-anim').convertToWorldSpace(cc.v2(0, 0))
        //   const alpha = this.sceneContainer.children[1].getChildByName('alpha')
        //   let relativeY = this.node.height / 2 + sceneCoordinate.y
        //   // let anchorX = sceneCoordinate.x - this.camera.x
        //   this.sceneContainer.children[1].y -= (relativeY)
        //   // console.info((1 + this.sceneContainer.children[1].scaleX - 0.5) * this.sceneContainer.children[1].getChildByName('window-anim').width)
        //   // console.info(this.sceneContainer.children[1].getChildByName('window-anim').width)
        //   // this.sceneContainer.children[1].y += (this.node.height / 2 - relativeY)
        //   // this.sceneContainer.children[1].scaleX
        //   // this.sceneContainer.children[1].setAnchorPoint(0.5 - anchorX / this.node.width, 0.5 - anchorY / this.node.height)
        //   this.sceneContainer.children[1].scaleX += (zy * dt * 2)
        //   this.sceneContainer.children[1].scaleY += (zy * dt * 2)
        //   alpha.opacity += dt * 1 * 50
        // }


      }
      if (this.camera.y < -50 & this.camera.y > -250) {

        this.sceneContainer.children[0].getChildByName('front').y += dt * 80 * .15
        this.sceneContainer.children[1].getChildByName('tree').y -= dt * 80 * .1
      }
    }
    if (this.startBackward) {

      if (this.camera.y < 0) {
        this.camera.y += sy
      } else {
        this.camera.y = 0
      }
      if (this.camera.y < -50 & this.camera.y > -250) {

        this.sceneContainer.children[0].getChildByName('front').y -= dt * 100 * .15
        this.sceneContainer.children[1].getChildByName('tree').y += dt * 100 * .1

      }
    }
  },
});

然后我的场景的话 就是基本就是 两个 求求大神们看一下

正常的,真机是比电脑上调试性能会差10-20倍,如果是加载太慢,可以考虑把图片做成图集

先试试看啊

这么简单的业务性能差这么多,明显不正常啊,希望官方多关注下。
另外建议尽量不要在update里 查找节点,特别是find。不过这个性能问题应该不是查找节点引起的。

我来回复一下 问题解决了, 其实不关引擎的事, 然后也和代码关系不大(目前的代码量很少 也没有密集的计算在),找到的原因是 我的手机一般都是开低电量模式的(iphone) 回复正常模式时候 就达到了 60fps 左右了

是的, 后来发现 是自己的问题, 我的手机一般都是开低电量模式的(iphone) 回复正常模式时候 就达到了 60fps 左右了

低电量玩其他游戏 卡不卡

没试过呢。 不知道玩游戏。 话说有一个新的问题出现了 老司机 带带路? 我横屏的时候 发现画布 旋转了180度 上下颠倒了。。很蛋疼

环境都是2.0.10 只有ios下会出现, 我在creator原生上,添加了个wkwebview,接入一个creator h5游戏,游戏会经常从60,降到30帧,我单独工程写一个wkwebview,却能一直60帧,感觉很诡异