Thursday, June 30, 2022
HomeGame DevelopmentWhy node isn't seem on scene runtime in cocos creator with typescript?...

Why node isn’t seem on scene runtime in cocos creator with typescript? – Cocos Creator


Right here is the code which I used to create node and attempt to add element sprite runtime in node.

I’ve additionally added node as youngster to present node which is already proven in scene. spriteFrame additionally getting load correctly as I’ve seen in debug console of the chrome.

const runtimeNode = new Node('runtimenode'); 
sources.load('test_assets/customimage/spriteFrame',SpriteFrame,operate(err,spriteFrame){
            if(err){
                console.log(err);
                return false;
            }
            runtimeNode.addComponent(Sprite).spriteFrame = spriteFrame;
});
this.node.addChild(runtimeNode);

Let me know if somebody already face identical challenge. let me know if I doing flawed right here.


Possibly you didn’t set the node’s layer,like this:

runtimeNode.layer = Layers.Enum.UI_2D

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments