{"id":8455,"date":"2023-07-10T13:42:32","date_gmt":"2023-07-10T11:42:32","guid":{"rendered":"https:\/\/store.algosyntax.com\/?post_type=asx-lms-tutorial-cpt&#038;p=8455"},"modified":"2026-03-10T00:23:28","modified_gmt":"2026-03-09T22:23:28","slug":"structs-in-unreal-engine-5-the-complete-guide","status":"publish","type":"asx-lms-tutorial-cpt","link":"https:\/\/store.algosyntax.com\/tutorials\/unreal-engine\/structs-in-unreal-engine-5-the-complete-guide\/","title":{"rendered":"Structs in Unreal Engine 5: The Complete Guide"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"8455\" class=\"elementor elementor-8455\" data-elementor-post-type=\"asx-lms-tutorial-cpt\">\n\t\t\t\t<div class=\"elementor-element elementor-element-8aa1458 e-flex e-con-boxed e-con e-parent\" data-id=\"8aa1458\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-55e6ba8 elementor-widget elementor-widget-text-editor\" data-id=\"55e6ba8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>The world of Unreal Engine 5 (UE5) is expansive and diverse, filled with various tools and components that make the development process intuitive and efficient. Among these tools, structs, short for structures, play a crucial role in organizing data in a meaningful and flexible way. In this guide, we will dive into the nuts and bolts of using structs in UE5, providing a comprehensive understanding of what they are, how they are defined, and how they can be used to enhance your game development.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4bc2636 elementor-widget elementor-widget-heading\" data-id=\"4bc2636\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Structs in UE5: What Are They?\n<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3550331 elementor-widget elementor-widget-text-editor\" data-id=\"3550331\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>In simple terms, a struct (or structure) is a user-defined data type that allows you to group variables of different types together. Think of it as a container for storing related data. For instance, if you wanted to store information about a player, you could use a struct to hold the player&#8217;s name, score, and health all in one place.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ec67c42 elementor-widget elementor-widget-heading\" data-id=\"ec67c42\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Defining Structs in UE5\n<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a5af271 elementor-widget elementor-widget-text-editor\" data-id=\"a5af271\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Structs in UE5 are generally defined in C++ and then used in both C++ and Blueprints. Here&#8217;s a simple example of how to define a struct in C++:<\/p><div class=\"bg-black rounded-md mb-4\"><div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\">\u00a0<\/div><\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3f22c0d elementor-widget elementor-widget-code-highlight\" data-id=\"3f22c0d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-cpp line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-cpp\">\n\t\t\t\t\t<xmp>USTRUCT(BlueprintType)\r\nstruct FPlayerInfo\r\n{\r\n    GENERATED_BODY()\r\n\r\n    UPROPERTY(BlueprintReadWrite, Category = \"Player Info\")\r\n    FString Name;\r\n\r\n    UPROPERTY(BlueprintReadWrite, Category = \"Player Info\")\r\n    int32 Score;\r\n\r\n    UPROPERTY(BlueprintReadWrite, Category = \"Player Info\")\r\n    float Health;\r\n};\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a77f7cd elementor-widget elementor-widget-text-editor\" data-id=\"a77f7cd\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>In this example, <code>FPlayerInfo<\/code> is our struct, which contains three variables: <code>Name<\/code>, <code>Score<\/code>, and <code>Health<\/code>. The <code>USTRUCT()<\/code> macro tells UE5 that <code>FPlayerInfo<\/code> is a struct that can be used in Blueprints, and <code>UPROPERTY()<\/code> designates the variables to be used in Blueprints as well.<\/p><div class=\"bg-black rounded-md mb-4\"><div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\">\u00a0<\/div><\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6a106d3 elementor-widget elementor-widget-heading\" data-id=\"6a106d3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Using Structs in UE5\n<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-607a9ef elementor-widget elementor-widget-text-editor\" data-id=\"607a9ef\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Once you&#8217;ve defined a struct, you can use it in various ways. Here are a couple of basic examples:<\/p><p><strong>Creating an instance of a struct in C++:<\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-69f27c5 elementor-widget elementor-widget-code-highlight\" data-id=\"69f27c5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-cpp line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-cpp\">\n\t\t\t\t\t<xmp>FPlayerInfo Player;\r\nPlayer.Name = \"John Doe\";\r\nPlayer.Score = 100;\r\nPlayer.Health = 100.0f;\r\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f77f887 elementor-widget elementor-widget-text-editor\" data-id=\"f77f887\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p><strong>Creating an instance of a struct in Blueprints:<br \/><br \/><\/strong>You can create a variable of your struct type directly in the Blueprint editor. Once you&#8217;ve created the variable, you can set its properties in the Details panel or in Blueprint nodes.<strong><br \/><\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2603086 elementor-widget elementor-widget-heading\" data-id=\"2603086\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Why Use Structs?\n<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f6fef8b elementor-widget elementor-widget-text-editor\" data-id=\"f6fef8b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Structs bring a lot of benefits to the table. They allow you to bundle related data together, which can make your code cleaner and easier to understand. They also simplify passing data around. Instead of passing multiple parameters to a function, you can pass a single struct. Furthermore, structs can be used in UE5&#8217;s visual scripting system, Blueprints, enabling even non-programmers to work with complex data.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-75f5cab elementor-widget elementor-widget-heading\" data-id=\"75f5cab\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Conclusion\n<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4f5a05a elementor-widget elementor-widget-text-editor\" data-id=\"4f5a05a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Structs are a versatile and powerful feature in UE5, allowing developers to write cleaner, more organized code. By understanding what structs are and how to use them effectively, you can enhance your game&#8217;s data handling and open up new possibilities for gameplay elements. As you continue to explore UE5, consider how structs can help you represent complex data in your game and streamline your development process.<\/p><p>\u00a0<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-41c49ed2 e-flex e-con-boxed e-con e-parent\" data-id=\"41c49ed2\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t<div class=\"elementor-element elementor-element-435ecf3e e-con-full e-flex e-con e-parent\" data-id=\"435ecf3e\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-2d94f79b elementor-widget elementor-widget-heading\" data-id=\"2d94f79b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Checkout Our Marketplace<\/p>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1a2a7003 elementor-widget elementor-widget-image\" data-id=\"1a2a7003\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/www.unrealengine.com\/marketplace\/en-US\/product\/blender-curves-importer\" target=\"_blank\" rel=\"noopener\">\n\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"540\" height=\"540\" src=\"https:\/\/store.algosyntax.com\/wp-content\/uploads\/marketplace\/unreal-engine\/spline-importer.png\" class=\"attachment-full size-full wp-image-6109\" alt=\"Blender To UE5 Spline Importer\" \/>\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-21949e92 e-con-full e-flex e-con e-parent\" data-id=\"21949e92\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-39c8954d elementor-widget elementor-widget-heading\" data-id=\"39c8954d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Exports Splines From Blender To Unreal Engine in 2 clicks! \n<\/p>\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-7ab69d68 e-con-full e-flex e-con e-parent\" data-id=\"7ab69d68\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-668e6e8f elementor-widget__width-auto elementor-widget elementor-widget-heading\" data-id=\"668e6e8f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\"><a href=\"https:\/\/www.unrealengine.com\/marketplace\/en-US\/product\/blender-curves-importer\" target=\"_blank\" rel=\"noopener\">&lt;b<strong><s><\/s> $49!<\/strong><\/a><\/p>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-60e06ba1 elementor-widget elementor-widget-button\" data-id=\"60e06ba1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm elementor-animation-grow-rotate\" href=\"https:\/\/www.unrealengine.com\/marketplace\/en-US\/product\/blender-curves-importer\" target=\"_blank\" rel=\"noopener\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Download Blender Spline Importer<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-391f2755 elementor-widget elementor-widget-heading\" data-id=\"391f2755\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-16723d45 elementor-widget elementor-widget-text-editor\" data-id=\"16723d45\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p><strong>Blender Spline Importer<\/strong> allows you to import Blender Curves into unreal engine 4\/5 as USplinecomponents! Don&#8217;t miss the sale!<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"featured_media":0,"template":"","asx-lms-tutorial-categories":[45,58],"asx-lms-tutorial-tags":[46],"class_list":["post-8455","asx-lms-tutorial-cpt","type-asx-lms-tutorial-cpt","status-publish","hentry","asx-lms-tutorial-categories-unreal-engine","asx-lms-tutorial-categories-unreal-c-api","asx-lms-tutorial-tags-cpp","entry"],"acf":[],"_links":{"self":[{"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/asx-lms-tutorial-cpt\/8455","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/asx-lms-tutorial-cpt"}],"about":[{"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/types\/asx-lms-tutorial-cpt"}],"version-history":[{"count":1,"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/asx-lms-tutorial-cpt\/8455\/revisions"}],"predecessor-version":[{"id":13362,"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/asx-lms-tutorial-cpt\/8455\/revisions\/13362"}],"wp:attachment":[{"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/media?parent=8455"}],"wp:term":[{"taxonomy":"asx-lms-tutorial-categories","embeddable":true,"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/asx-lms-tutorial-categories?post=8455"},{"taxonomy":"asx-lms-tutorial-tags","embeddable":true,"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/asx-lms-tutorial-tags?post=8455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}