UE4 c++ UStruct syntax

Sdílet
Vložit
  • čas přidán 22. 08. 2024
  • Quick tutorial showing the set-up of a blueprint friendly UStruct in c++
    Syntax for copy pasting: (Note I took out the TEnumAsByte entry as descriptions don't allow Brackets)
    USTRUCT(BlueprintType)
    struct FWeaponData
    {
    GENERATED_USTRUCT_BODY()
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Struct")
    ACharacter* player;
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Struct")
    int32 ammoCount;
    };

Komentáře • 10

  • @PolypusherStudios
    @PolypusherStudios Před 8 lety +6

    Just a quick headsup for people who may be getting VS editor errors with the #include "X.generated.h" lines etc, you have to close VS, hop over to the Unreal Engine Project File, right click and select 'Generate Visual Studio project files'.
    Great tutorial btw ;)

  • @virtualriot4062
    @virtualriot4062 Před 4 lety +1

    If you watch it in 2020, dont forget to add #include "ClassName.generated.h", close editor and rebuild to get it work

  • @pirofagista
    @pirofagista Před 7 lety +2

    Thanks, dude.

  • @virtualriot4062
    @virtualriot4062 Před 4 lety

    grazie

  • @Kurosaki8552
    @Kurosaki8552 Před 6 lety

    cool video, is there a way to set the struct members in the source file?

    • @matthewhennegan839
      @matthewhennegan839  Před 6 lety

      You can create and edit it like any normal c++ struct from code, there's plenty of other tutorials which show the syntax for doing that. This video was specific to getting it to play nicely with blueprint sorry!

    • @Kurosaki8552
      @Kurosaki8552 Před 6 lety

      you say there's plenty of tutorials but there's not plenty about editing structs in c++; only declaring them... no worries, we have blueprint for that part.

  • @shaqm0bile
    @shaqm0bile Před 5 lety

    how did you get your intellisense to work? mine pops 99999999999 errors, despite installing the intellisense ue4 plugin.

    • @shaqm0bile
      @shaqm0bile Před 5 lety

      ah nvm as soon as i included the generated header, everything was fixed!