How to setup stage when extension startup?

I want to create a new stage with some init settings when extension startup:

class Extension(omni.ext.IExt):
    def on_startup(self, ext_id):
        # new stage
        omni.kit.stage_templates.new_stage_with_callback(on_new_stage_fn=on_new_stage, template='sunlight')

def on_new_stage(*args):
    stage = omni.usd.get_context().get_stage()

    # some init settings
    UsdGeom.SetStageUpAxis(stage, UsdGeom.Tokens.z)

and I start Create with my extension “”:

call "c:/ov/pkg/create-2021.3.6/omni.create.bat" --ext-path "c:/src/locapi/locapom/exts/" --enable

[18.993s] [ext:] startup
[19.069s] [ext: omni.kit.window.stats-0.1.0] startup
[19.192s] [ext: omni.create-2021.3.6-rc.7] startup
[19.193s] [ext:] startup
[19.712s] app started
[20.834s] [ext: omni.kit.builtin.init] startup
[20.834s] [ext:] startup

but I find that my init settings will be overridden by a new blank stage in Create, just like opening Create app directly.

How can I start my extension after Create is fully launched? Or just later than omni.kit.builtin.init/menu?

Hello @epw! Thanks for reaching out to us. I will get a developer to help you with your questions.

1 Like

Is there a solution? I want to automatically startup my extension and pop up the ui when I start Create with bat, rather than manually open Create and search in windows/extension and click the startup button.