Sign in to follow this  

UE4 Blueprint & C++ Cheat Sheets

Recommended Posts

khawk    2925

Reddit user Wafflyn made useful Blueprint and C++ cheatsheets for anyone using UE4. From the post:


Made these cheat sheets for myself and others as I remember first starting out with UE4 transitioning to UE4 style of C++ there were many unknowns. Mostly focused on beginner's needs currently for these cheat sheets.

UE4 Blueprint Cheat Sheet:

UE4 C++ Cheat Sheet:

View full story

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Partner Spotlight

  • Similar Content

    • By MarcusAseth
      I don't know why this is happening, in the image below you can see my current situation.
      Basically I have an Utility.h header which contains wathever random stuff I think is useful at the time but don't yet deserves it's own separate file, so inside of it I've put a BaseFont class and defined it in place since I am not sure it will stay into Utility.h for long (Font is an alias for BaseFont because I wanted the internal variable name for the font to be Font, and that would collide with the class name, so that's why I have it setup like this) and right below this class, still in the header, I have a global object constructed from it so that I can use it everywhere for debug since pretty much all my .cpp #include "Utility.h". Now when I close the game I get an error that says "Breakout.exe stop working" and I tracked it down to the BaseFont destructor. On the right of the image you can see the local variable situation at that break point, which doesn't looks good...
      I have some assumptions regarding the cause but I am not quite sure, can you tell me what its going wrong exactly?

    • By MarcusAseth
      Hi guys, I'm not quite sure how to achieve this
      Here what I got so far, my GameMode class own an object of type Physics:
      class Physics { private://variables GameMode* Game; public://constructors Physics(GameMode* gameRef); ~Physics(); public://methods bool IsColliding(Entity* current, ECollisionTest collisionTestType); private://methods bool BoxCollisionTest(const Rect& current, const Rect& other); }; And since all my entities have a pointer to the GameMode they can retrieve a pointer to the Physics object, so when they move they can query the Physics object to see if they collided with something, passing "this" as the object to control against all the Entities inside GameMode, like this:
      //Collision Check if (PhysicsManager->IsColliding(this, ECollisionTest::EBoxCollisionTest)) { LogConsole("Collision"); } and IsColliding() goes like this:
      bool Physics::IsColliding(Entity* current, ECollisionTest collisionTestType) { for (auto& E : Game->Entities) { if (current != E.get())//avoid self testing { switch (collisionTestType) { case ECollisionTest::EBoxCollisionTest: { if (BoxCollisionTest(current->GetCollisionBox(), E->GetCollisionBox())) { return true; } } break; } } } return false; } Now, there are two things I don't like about my current setup.
      1) I am testing against all the entities. The paddle of the Breakout game can only move left and right, and hit either a ball or the left/right boundary, makes no sense to test it against 50 bricks at every update.
      2)From inside the Paddle class I am calling "IsColliding(this, ECollisionTest::EBoxCollisionTest)" so there is the assumption that all the entities that can collide with this one require a box test. May not be the case, maybe I have a "worm" entity running on the screen and it requires another type of collision test, so the choosen function to run shouldn't relying on me explicitly saying which one is, but it should be called at runtime trough overload, based on the type of Entity being compared. So maybe the Paddle<->Ball comparison would do a BoxCollisionTest, while Paddle<->Worm comparison would do something else.
      So how do I get it to work the way I want?
      This is what I want:
      1)Physics object is working with Entity*, and yet I need it to being able to distinguish between a Paddle* and or a Brick* or a Boundary* or a Ball* (all of this inherit from entity), a bit kind of like Unreal Engine BlueprintEditor Cast node, which allow me to say "Cast to Door" and if the thing was a door it return success, otherwise fails. Can you show me an example of how such mechanism is built, in code(C++)?
      2)Physics object should just call a generic TestCollision() function between the "this" passed (the current colliding object) and all the other entities, and then the overload resolution calls the appropriate function based on the types. And yet this shouldn't fail to compile for pairs for which I don't explicitly overload, for instance I wouldn't overload for Paddle<->Brick because such comparison will never happen, so when Paddle<->Brick comparison is performed, it should just return false even though I never declared a TestCollision(Paddle* p, Brick* b). 
      How can this be achieved?
    • By cozzie
      During the journey of creating my 2nd 3D engine, I'm basing quite some of the approaches on the Game Engine Architecture book (Jason Gregory). I've now arrived on the topic: IO.
      In short, the target platforms for me are PC, XBone and PS4.
      With this main assumption I thought of the following logics/ guidelines to follow:
      - I can assume file/folder structures will work on all 3 platforms, when I use '/' as a folder separator
      -- I will define 1 global with the base folder for the application, the rest will 'inherit' from there
      (which can be anything, independent of the 'mount' or drive)
      -- for now I'll create 1 subfolder with data/files that might need write access, so later on I only have to worry about 1 subfolder (settings, configs etc.).
      - file extensions can be longer than 3 characters (in Linux based FreeBSD on PS4)
      - all class members functions needing to load a file, shouldn't have to now about the file structure of the logical application, so they will all take a full filename string including path
      (combining root + subfolder + filename and separators is then the responsibility of the caller/ calling code)
      - some functions will need to be passed a folder, because contents in that folder need to be read OR I can simply define a small list of defined subfolders (under root/ base), because it won't be more then 5 to 10 folders in total (data/shaders, data/textures, data/objects, data/sound etc.)
      My questions:
      - what do you think about this approach?
      - regarding the last point, which of the 2 options would you apply?
      -- option 2 might work fine but feels a bit 'static', not very flexible (on the other hand, would you actually need flexibility here?)
      Any input is appreciated, as always.
    • By RubenRS
      How do i open an image to use it as Texture2D information without D3DX11CreateShaderResourceViewFromFile? And how it works for different formats like (JPG, PNG, BMP, DDS,  etc.)?
      I have an (512 x 512) image with font letters, also i have the position and texcoord of every letter. The main idea is that i want to obtain the image pixel info, use the position and texcoords to create a new texture with one letter and render it. Or am I wrong in something?
    • By MarcusAseth
      this is super strange...
      I have this function here:
      template<typename TFirst, typename... TArgs> bool util::LogConsole(const TFirst& first, const TArgs&... rest) { std::cout << first << " "; return LogConsole(rest...); } bool util::LogConsole() { std::cout << std::endl; return false; } it's recursive, keep printing "first" and recursively sending the rest, until rest is empty and the overload taking no argument is called, which just print a newline. Ignore the bool return.
      Anyway, now I have this code somewhere else:
      for (auto& E : Entities) { float valx = E->GetPosition().x;//return 751 float valy = E->GetPosition().y;//return 838 LogConsole(valx, valy); } Entities is a vector<unique_ptr<Entity>> which currently only contains the derived from Entity player Paddle, so I access the Base class Entity method called GetPosition, which is the center pivot coordinates of the object.
      I pass the variable to LogConsole which predictably prints:
      But not I try to call LogConsole without those 2 variables inbetween, like this:
      for (auto& E : Entities) { LogConsole(E->GetPosition().x, E->GetPosition().y); } and watch what kind of output I get! :
      ... the y value is an unreasonable value o_o
      How is this even possible?! Since only the second value is being affected, my assumption is that there is some weird interplay with the second template parameter, the variadic argument...but I wasn't able to debug it even stepping trough it line by line...can anyone come with an explanation for this really strange behaviour?
  • Popular Now