Posts

Showing posts from June, 2022

Edit C++ variables inside Unreal Editor using UPROPERTY

Image
  For example, adding an integer variable in an AMyActor class in the MyActor.h file: int32 myInteger = 777; Now if we want to access that variable in the Unreal Editor, we can precede the above declaration of myInteger with: UPROPERTY (EditAnywhere) Then we would have: UPROPERTY(EditAnywhere) int32 myInteger = 777; Notice we don't put a semicolon after UPROPERTY(EditAnywhere) because it's part of the same declaration as the integer below. Use UPROPERTY with it's property specifiers to control how the property behaves with various aspects of the Engine and Editor The EditAnywhere specifier indicates that this property can be edited via property windows, archetypes and instances within the Editor. For more information: Unreal Engine 5 Documentation - Properties Unreal Community Wiki - UPROPERTY  

Blueprint Functions Plus Custom Input/Output Pins

Image
  Unreal Engine 5 Documentation - Functions Functions are node graphs belonging to a particular Blueprint that can be executed, or called, from another graph within the Blueprint. 1. Inside the Content Browser , click the New Button then select Blueprint Class .   2. In Pick Parent Class window, select Actor .  3. Name the Blueprint, then Double-click on it to open it up in the Blueprint Editor. 4. Right-click in the graph and search for and add the Event Begin Play Event. This node will execute once when the game is launched, along with any script that follows it.  5. Right-click in the graph and search for and add the Get Player Controller node.  This will get the currently assigned player controller and allow us to Enable Input for this Blueprint.  6. Right-click in the graph and search for and add the Enable Input node. This is the node which will allow input to be received for this Blueprint.  7. Connect the Event Begin Play Node'...

Flow Control: Switch Nodes, Branch Node, ForLoop Node, etc...

Image
Unreal Engine 5 Documentation - Flow Control   Flow Control : Nodes that allow for controlling the flow of execution based on conditions.   Switch Nodes A switch node reads in a data input, and based on the value of that input, sends the execution flow out of the matching (or optional default) execution output. There are several types of switches available: Int , String , Name , and Enum . In general, switches have an execution input, and a data input for the type of data they evaluate. The outputs are all execution outputs. Enum switches automatically generate the output execution pins from the Enum's properties, while Int , String , and Name switches have customizable output execution pins.  Standard Flow Control Nodes The Branch node serves as a simple way to create decision-based flow from a single true/false condition. Once executed, the Branch node looks at the incoming value of the attached Boolean, and outputs an execution pulse down the appropriate output. The...

Blueprint Variables

Image
Unreal Engine 5 Documentation - Blueprint Variables Blueprint Variables are properties that hold a value or reference an Object or an Actor in the world. Variables are displayed as rounded Nodes containing the name of the variable and having a color coded out pin representing what type of data the variable holds.   Boolean [Maroon]: True or false value (bool). Byte [Sherpa Blue]: Whole number value between 0 and 255 (unsigned char). Integer [Sea Green]: Whole number value between −2,147,483,648 and 2,147,483,647 (int). Integer64 [Moss Green]: Whole number value between −9,223,372,036,854,775,808 and 9,223,372,036,854,775,807 (long). Float [Yellow Green] Number value with a decimal such as 0.0553, 101.2887, and -78.322 (float). Name [Mauve]: Piece of text used to identify something in the game. String [Magenta]: Group of alphanumeric characters such as Hello World (string). Text [Pink]: Text that you display to users. Use this type for text that you want to localize. Vector [Gold]:...

Level Blueprint, Hello World!

Image
  Level Blueprints are used for scripting level-specific events within maps. It's a specialized type of Blueprint that acts as a level-wide global event graph. Each level in your project has its own Level Blueprint created by default that can be edited within the Unreal Editor, however new Level Blueprints cannot be created through the editor interface.       To create a Level Blueprint for the current level, you need to select the Blueprint button from the toolbar. In earlier versions of Unreal, before version 5, you could see a toolbar button called "Blueprint".  At this time of this blog post, version 5.0.2 still has this three white dots button to select. Seems like it's a placeholder to be updated with a newer graphic later, just assuming. Look at this picture below: If you select the three white dots drop-down, you'll see "Open Level Blueprint". Select that.  A new window Level Blueprint Editor will open with the same name as your level. Go...

Create Blueprint Class from Object, Instances

Image
 Creating a Blueprint Class from an Object    Add a sphere to the level, select it. Over in the Details window for that actor, the name of the sphere should be 'Sphere'. Over to the right of that you'll an '+Add' button, just right of that is a details button that when you hover over it, it should say "Converts this actor into a reusable Blueprint Class that can have script behavior". Click that button    A window will pop-up that says "Create Blueprint From Selection" at it's top. We want a "New Subclass" so we can just leave it all as is. At the bottom, we can give a new name. Apparently, it's custom to prefix a new Blueprint Class name with 'BP_'. So here we can name it BP_Sphere . Press the "Select" button at the bottom.    A new Unreal Editor window will pop-up for the newly created BP_Sphere. You can, if you want, dock that new window with the first Unreal Editor window to keep it all together. Then go to...

Objects and Referencing

Image
[ NOTE : This is mostly condensed information from the Unreal Online Documentation so I can get a quick reference from]     Objects are basically anything you can load in Unreal Engine and are the most basic class. They act like building blocks and contain a lot of the essential functionality for your Assets. Almost everything in Unreal Engine inherits (or gets some functionality) from an Object. Basically, collections of data and functionality. These Objects can be an Actor, a Material, Lights, Components, etc...    The base class for objects in Unreal is UObject . The UCLASS macro can be used to tag classes derived from UObject so that the UObject handling system is aware of them.     Method NewObject<class> Creates a new instance with optional parameters for all available creation options. Offers a wide range of flexibility, including simple use cases with an automatically generated name.    The keyword new can be used used to ...

Levels, Blueprints, Components, Graphs, Nodes

Image
   Here, for my learning purposes, I have taken info from the Unreal online documents, and bit of my own info, to help me visualize and breakdown most of all the general parts of Blueprints. It's to help me see the relationships between these terms a bit quicker and also may help me to know what to search for in the online documentation or elsewhere if I need more info. Levels contain everything a player can see and interact with, like environments, usable objects, other characters, and so on. Unreal Engine saves each Level as a separate .umap file, which is why you will sometimes see Levels referred to as Maps .  A Blueprint Class , often shortened as Blueprint , is an asset that allows content creators to easily add functionality on top of existing gameplay classes. Blueprints are created inside of Unreal Editor visually, instead of by typing code, and saved as assets in a content package. Level Blueprints are used for scripting level-specific events within maps. I...

Blueprint Project Adding C++ and Compiling

Image
[ NOTE : As of this blog post, I have not tried a new UE C++ based project yet.]      Being new to the Unreal Engine world, I found this bit quite interesting. Coming from Unity, after whatever C# code changes you make, Unity will basically compile/update automatically when going back to the Unity Editor.  For a new UE blueprint project, we need to "Build" the project in the VS editor, first, and then manually tell UE to "Live Code Update" when we make changes to our C++  code.    For example, we could start off in a new UE blueprint project and want to make our first C++ Actor Class. So we go to the Tools menu and select New C++ Class which then brings up the new class wizard window. In the window we select Actor and then click on the next button to then give our new Actor class a name. NOTE : This name is the actual class name that is used in C++ code in the header file and source file. So you may want to follow whatever naming conventions you l...

Lighting Needs To Be Rebuilt

Image
     Apparently this problem has been around for a while. Opening a new project, Unreal Editor may state that the lighting needs to be rebuilt in red text in the level viewport. Go to the Build Menu, if you want to change the lighting quality, then you can first select the quality by selecting the Lighting Quality from the Build Menu and then select a quality. Then to rebuild the lighting, from the Build Menu, select 'Build Lighting Only'. A progress window will pop-up and that's it.

Setting up Visual Studio 2022 for UE5.

Image
   Download :     After you have installed Unreal Engine 5, you can go to Microsoft's site at https://visualstudio.microsoft.com/vs/ to download the programming editor to use with UE5 and C++ programming. At the time of this writing, I chose Visual Studio Community 2022. Note: There's no reason why I chose VS2022 over other editors except that I've always used the Microsoft's VS Editors. It works.   Installing:     Run the Visual Studio Installer. You need to customize the install for Unreal Engine 5 by selecting these three workloads under the Workloads tab: .NET desktop development Desktop development with C++ Game development with C++ Also under the right hand side window pane, make sure this is checked: Unreal Engine Installer Under the Individual components tab, make sure this is also selected: NET Core 3.1 runtime (LTS) Then select the Install button on the bottom right. Note: This may require a computer restart afterwards.   U...

ABOUT

Image
[ NOTE : Information here at this blog may never be complete or may need things added or corrected. I'm not thinking about making big comprehensive/detailed tutorials. But, If you would like to let me know if I need to fix a little something, please do so. Thanks! 😃 ]     The mission of this blog is to try to blog little tidbit tutorials and info on both Blueprints and C++ programming in Unreal Engine 5.  Hopefully, a wide range of topics will be provided. I'm doing this because I'm new to the Unreal engine and found it very interesting. The new lighting system, Lumen, is down right fantastic. Reading up and going through tutorials, I can see how powerful the blueprint system used along with C++ can be.    I have decades of programming experience in C, C++ and C# ever since the AMIGA days...  yeah I'm getting old. I'm pretty familiar with the Unity game engine ever since it's 2018 version. I'm not going to draw comparisons here. Unity is a powerful, p...