Unreal engine 5 tutorial on running python inside visual studio code to streamline game pipelines.

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 พ.ค. 2024
  • This is a getting started with Python and Unreal engine 5 tutorial where I walk through the config needed to setup VS Code (Visual Studio Code) extension that will allow you to run python scripts from VS Code to Unreal Engine 5.
    *Some good reading / Viewing*
    UE5 Python docs - docs.unrealengine.com/5.1/en-...
    Getting started Guide - docs.unrealengine.com/5.1/en-...
    Getting started UE video - • Python in Unreal Engin...
    Manual code completion (Optional if VSCode extension does not work) - docs.unrealengine.com/4.27/en...
    Install Python modules - • Python Install Modules...
    Beginner tutorial - • Python Setup For Unrea...
    Manually setting code completion - docs.unrealengine.com/4.27/en...
    0:00 Intro
    0:46 Installation
    3:29 Code completion + Debugging
    4:58 Code examples
  • ภาพยนตร์และแอนิเมชัน

ความคิดเห็น • 29

  • @Imtinan.ACEDIA
    @Imtinan.ACEDIA หลายเดือนก่อน

    Thank you so much! So much of my time was wasted finding the solution LOL.

  • @rymdnisse
    @rymdnisse ปีที่แล้ว +1

    Hi, thanks for making this video and featuring the extension! :)
    At 03:37 the output is currently being re-routed to VS Code's Output channel (at the bottom), but I'll look into making sure the output is still printed to the Output Log in Unreal as well.

    • @DirkTeucher
      @DirkTeucher  ปีที่แล้ว

      Oh awesome you are welcome and thank you for making the extension it's fantastic. I see you have been updating it also which is great to see.

  • @raphaelzurcher2153
    @raphaelzurcher2153 ปีที่แล้ว +1

    Hi Dirk,
    Thanks for this awesome video and the extension in VS.
    Could you do another video or quick explanation on how to run python scripts without making it block the UE editor, so using ticks or multi processing/threading to update the UI or just run the script as a separate task?
    Cheers!

    • @DirkTeucher
      @DirkTeucher  ปีที่แล้ว

      I have no idea how to do that, you might want to ask the developer or post the question on the github. I do know that Python is not supported at runtime yet so perhaps multithreading and non blocking is just a current limitation in Unreal. Nils may take a few days to reply but he answered my questions and fixed the problems I raised. He also commented on this video so you may want to go check out that comment and his youtube page - "Nils Söderman" .

  • @freshmaker4o
    @freshmaker4o 7 หลายเดือนก่อน +1

    You are gentlemen, sir.

    • @jankobananko
      @jankobananko 6 หลายเดือนก่อน

      and a scholar!

  • @niroumand
    @niroumand 9 หลายเดือนก่อน

    Thank you

    • @DirkTeucher
      @DirkTeucher  9 หลายเดือนก่อน +1

      You're welcome. I hope it proves to be useful to you. I have been using this plugin at work and am loving it.

  • @arjunpankajakshan4220
    @arjunpankajakshan4220 8 วันที่ผ่านมา

    Hi Dirk, Many thanks for the video. I am getting a ‘no module found error’ when trying to run ‘import unreal’ in vscode? Can you please recommend a solution here?

  • @SaiyanRGB
    @SaiyanRGB 2 หลายเดือนก่อน

    Can i Uuse python code in unreal engine using this instead of blueprint or c for machine learning deep reinforcement learning

  • @w4hns1nnn
    @w4hns1nnn 3 หลายเดือนก่อน

    Is there an option to add Unreal Python: execute directly when I hit the debug option in VS Code? Otherwise it always starts in an arbitrary python environment complaining with the import unreal statement

  • @justinl5914
    @justinl5914 ปีที่แล้ว

    6:47 Is there any reason to use "print" vs "unreal.log" on line 8 and 9 or are they basically the same?

    • @DirkTeucher
      @DirkTeucher  ปีที่แล้ว

      From a users perspective they appear to do exactly the same thing if you are just printing text. But logging usually also allows you to configure things like priority or assign categories to the print messages. Print as far as I know just prints out a value. Though I have not tried to customize the logging in unreal yet so it might not be possible with this workflow.

  • @MrOpenedBox
    @MrOpenedBox ปีที่แล้ว +1

    i'm having some issues with the install wondering if you could help :) firstly i can't seem to figure out why my intellisense sense to not recognize the unreal keyword. Also vs code keeps asking me to enable developer mode in unreal while it is..and lastly the debug command won't run due to vscode saying debug.py cannot be installed and have to be manually installed in the engine sys. path..any help would be greatly appreciated thank you!

    • @DirkTeucher
      @DirkTeucher  ปีที่แล้ว

      Sure thing. Can you let me know the steps you have taken and version of unreal+vscode you are using? - I followed these steps here to manually setup autocompletion in vscode. You might need to do that. - docs.unrealengine.com/4.27/en-US/ProductionPipelines/ScriptingAndAutomation/Python/Autocomplete/

    • @MrOpenedBox
      @MrOpenedBox ปีที่แล้ว

      @@DirkTeucher hey! Thank u so much for the quick reply… for the most part I think the issue sorted itself out, I had to do that python stub thing manually too. it’s odd though I now get autocompletes but still a warning to enable developer mode.

    • @DirkTeucher
      @DirkTeucher  ปีที่แล้ว

      No worries, glad you figured out the problem. Not sure about the dev mode warning but i did have to trust scripts for it to run. Looking at the github I trust it. The owner appears to be working at a game studio from what I can see so it looks legit to me at least but while I am quite paranoid and diligent I am no security expert :D

    • @MrOpenedBox
      @MrOpenedBox ปีที่แล้ว

      @@DirkTeucher i'm gonna put my faith in the goodness of game devs :p! I was wondering though as to what part of the development process a tool like this would fit into? I'm a complete python noob...but I do see that one is able to preload in python startup scripts natively in unreal, so would the purpose of this tool be used for real time experiments?

    • @DirkTeucher
      @DirkTeucher  ปีที่แล้ว

      ​@@MrOpenedBox I am learning this because I know that Python is used by Tech tool developers which is something I am working towards doing myself. As for this particular VSCode extension I don't think it is essential as you said already you can load in Python using the load python BP node but I find having code completion, error reporting and real time execution useful when learning and VSCode has a bunch of other cool code extensions I can use to make my life easier when writing a bunch of python. Also Python does not work at runtime yet so for now it's used only to edit existing assets, import assets and automate certain settings like enable nanite automatically perhaps. And for editor tools for artists. Probably other things too that I am not aware of.
      The use cases for python that I have seen so far are mainly for developing pipeline tools. Like send2unreal is a blender addon which uses python to send files to Unreal and it's pretty robust. You can also automate tasks using python plus the Editor Widget + the load Python BP node so that artists can automate certain repetitive boring tasks. I read somewhere that almost everything you have access to in C++ is available in Python so you can automate pretty much anything and if something is missing expose it with C++ .
      You could even use Python to populate an area of space with a load of random garbage meshes for example and then enable pyhsics on them to allow the static meshes to fall into place naturally if you have the game running in simulation mode. There are so many ways this could be used. Though whether python is better than Blueprints I would think depends on what you are more experienced with using. I don't know C++ very well so for me using Python feels more intuitive and I have already seen some functions that are not in BP that are in C++ and Python so you have access to a few more features. I am sure that is why this capability was added in the first place for devs like myself :D ... I do need to spend more time with C++ though too.
      If Epic can find a way to efficiently add Python to runtime that would be pretty cool too I would imagine but would require pre compilation to C++ so I expect so they probably will not.

  • @limo5228
    @limo5228 9 หลายเดือนก่อน +1

    HiHi, I have a problem. When I type "import unreal", a yellow wavy line appears below "unreal". What usually causes this😮

    • @DirkTeucher
      @DirkTeucher  9 หลายเดือนก่อน

      Not sure. I would guess you might need to remove the extension and reinstall it again and run the commands to connect visual studio code to unreal. What version of Unreal are you using?

    • @limo5228
      @limo5228 9 หลายเดือนก่อน

      @@DirkTeucher I am using UE5.2. I have opened the plug-in in UE according to the tutorial carefully, and downloaded the required extension in VS. I have checked the official document, and I do need to add some steps, I am trying, thank you for your reply.

    • @limo5228
      @limo5228 9 หลายเดือนก่อน

      @@DirkTeucher My VS seems to be able to connect to UE. But I encountered a new problem. After entering "Unreal Python. attch", VS popped up "Python module 'debugpy' is required for debugging", and UE's log displayed "LogPython: False”. This popup has an "Install" button, "Failed to install debugpy, please install it manually and make sure it's in the sys.path for Unreal Engine" is displayed. I successfully installed Debugpy in the VS extension, but it did not work for this error

    • @DirkTeucher
      @DirkTeucher  9 หลายเดือนก่อน

      @@limo5228 What version of python do you have installed? Did you install python from the microsoft store? And is unreal engine installed in the default location on your c: drive?

    • @limo5228
      @limo5228 9 หลายเดือนก่อน +1

      @@DirkTeucher I am installing python3.9.7 and my UE is installed on a non-default path, and the above error does not seem to be relevant. After my continuous attempts, VS and UE have successfully connected and printed the first line of characters, I feel very excited, I will summarize the detailed steps to help people who encounter the same mistake, thank you for sharing let me take the first step!