问题
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