How to disable a node like in the creator?

if i do this in the creator:

this.node.active = false

my fps, a device performance etc goes up

How can i disable a node in a cpp project?

1 Like

setEnabled(bool);

This is not a true
cocos2d::Node class does not have “setEnabled(bool)” function

And as i see only an ui classes have this function. But in the creator you could do it for all game object on a scene.

And this function does not disable an ui node. I still see an ui node on a scene. Creator’s way looks like remove a node from scene. It stops rendering a node, updating a node, etc.

I am using v4.0

If you want to remove the node:

removeFromParentAndCleanup()
Or
removeFromParent()

depending upon your needs.

setVisible(bool)

To show/hide

pause()

Pause pauses the node’s scheduled function calls, its actions and its events

resume()

to resume.

I misread your first post. I apologize. I was driving to an appointment and answering at the same time.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.