libGDX : How check if the actor exist on stage or not

纵饮孤独 提交于 2019-12-23 16:17:46

问题


How can I check the actor is removed or not on stage ?

like this:

if(actor.isRemoved) {
   // enter code here
}

回答1:


From the Documentation:

getStage

public Stage getStage() Returns the stage that this actor is currently in, or null if not in a stage.

So you can use it like:

if(actor.getStage() == null) {
    //actor not on stage
}


来源:https://stackoverflow.com/questions/33270598/libgdx-how-check-if-the-actor-exist-on-stage-or-not

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!