public static void centerActor ( final Actor actor , final Stage stage ) { if ( actor != null && stage != null ) { actor . setPosition ( ( int ) ( stage . getWidth ( ) / 2f - actor . getWidth ( ) / 2f ) , ( int ) ( stage . getHeight ( ) / 2f - actor . getHeight ( ) / 2f ) ) ; } }
Null - safe position update .