Friday, July 1, 2022
HomeGame DevelopmentWhy node is just not seem on scene runtime in cocos creator...

Why node is just not 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 little one 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,perform(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 subject. let me know if I doing flawed right here.


Perhaps 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