C++ ComponentJS errors

C++ ComponentJS errors
0.0 0

#1

So, i’ve tried lot of variations ComponentJS usage and js styles, but it just isn’t works.
It crushes on GetNewType, NewObjectWithGivenProto, JS_GetClass and etc.
I have working model on 3.9, but lot of things changed - It isn’t works on 3.15
Is someone have working example for 3.15?

So, i’ve tried simple

test = cc.ComponentJS.extend({
    // add a new enemy every second
    onEnter: function() {
        cc.log("enter");
    },
    onAdd:function(){
      cc.log("add");
    },
    onInit:function(){
      cc.log("init");
    },

    update: function(dt) {
        cc.log("update");
    },
});

and it works fine in js itself:

    var sc = new cc.Scene();
    cc.director.runScene(sc);
    var sceneJSComponent = new cc.ComponentJS("src/testScene.js");
    sceneJSComponent.setName("sceneJSComponent");
    sc.addComponent(sceneJSComponent);

but crushes in

auto c = ComponentJS::create("src/testScene.js");

#2

It’s very interesting situation - Components causes error after cc.game.onStart function is done. Even if components created in cpp code, but from cc.game.onStart - it works.
But after that(With scheduleOnce for example) it crashes


Fix: it crushes if you call something from cpp with schedule, but js schedule is good