No announcement yet.

-ExecutePythonScript vs -run=pythonscript vs ON startup SpawnActorFromObject Discrepancies

  • Filter
  • Time
  • Show
Clear All
new posts

    -ExecutePythonScript vs -run=pythonscript vs ON startup SpawnActorFromObject Discrepancies

    I'm going bonkers and could use some help.
    I have a script that works (it will add an asset to the world)
    -IF I run it from the output log command line in editor
    -IF I run it as a startup script for the project
    it does not work:
    -IF run with ExecutePythonScript
    -IF run with -run=pythonscript

    The script actually runs using the -run flag BUT the problem is it doesn't spawn the actor. I get the following warning:

    LogEditorScripting: Warning: SpawnActorFromObject. No actor was spawned.

    The script is the from the shotgun integration tools.

    Any ideas on this would be appreciated.... It feels like the editor isn't fully loading, BUT it does import assets etc and hit all my prints breaks etc.
    Thanks in advance!!
    Oh and I've tried 4.21 and 4.22 for this.

        # Import the FBX into Unreal using the unreal_importer script
        current_folder = os.path.dirname( __file__ )
        if current_folder not in sys.path:
        import unreal_importer
        fbx_file_path = argv[0]
        content_browser_path = argv[1]
        turntable_map_path = argv[2]
        # Load the turntable map where to instantiate the imported asset
        world = unreal.EditorLoadingAndSavingUtils.load_map(turntable_map_path)
        if not world:
        # Find the turntable actor, which is used in the turntable sequence that rotates it 360 degrees
        turntable_actor = None
        level_actors = unreal.EditorLevelLibrary.get_all_level_actors()
        for level_actor in level_actors:
            if level_actor.get_name() == "Character_Turntable":
                turntable_actor = level_actor
        if not turntable_actor:
        # Destroy any actors attached to the turntable (attached for a previous render)
        for attached_actor in turntable_actor.get_attached_actors():
        # Derive the imported asset path from the given FBX filename and content browser path
        fbx_filename = os.path.basename(fbx_file_path)
        asset_name = os.path.splitext(fbx_filename)[0]
        asset_path_to_load =  content_browser_path + asset_name
      # Load the asset to spawn it at origin
        asset = unreal.EditorAssetLibrary.load_asset(asset_path_to_load)
        actor = unreal.EditorLevelLibrary().spawn_actor_from_object(asset, unreal.Vector(0,0,0),unreal.Rotator(0,0,0))