Home > Articles

  • Print
  • + Share This
This chapter is from the book


  • Q. Why should I put all the game logic in a Game Mode instead of in a Level Blueprint?

  • A. There is no requirement that game logic be put in one place or the other. Instead, it helps to think of the separation as a way to reduce repeated work later. All the logic that is shared between multiple levels should probably be put in a Game Mode or individual Actors, while level-specific logic (like triggers that cause doors to open or lights to turn on) should usually be put in Level Blueprints. You can choose to put everything in Level Blueprints, but if you decide to make a new level, you will have a harder time making sure everything works there and stays up to date than if you primarily use a Game Mode.

  • Q. Does a Pawn need to inherit from the default Pawn?

  • A. Not at all! DefaultPawn is just a convenience class, but all its features can be replicated with a bit of work. UE4 also comes with some other convenient Pawn classes, such as the Character class, which contains a Skeletal Mesh component and some logic dedicated to locomotion.

  • Q. Positioning a camera by inserting raw numbers is difficult. Do I have to spawn a camera this way?

  • A. No. Another option is to place a camera in a level and then reference it in level script when calling Set View Target with Blend. This brings the logic out of the Game Mode and makes it level specific, allowing easier artistic control of the camera.

  • Q. I don’t like the speed at which my Pawn moves. Can I change it?

  • A. Absolutely. To change the Pawn’s movement speed, open up the Pawn’s Blueprint Class Editor and select MovementComponent. In the Details panel, set the three float values that control the Pawn’s max speed, acceleration, and deceleration.

  • Q. Do I have to use only the single MeshComponent in the Hero_Spaceship Pawn Blueprint class?

  • A. No, you can use any number of components to define the visuals of a Pawn. If you are adding several components (or even if you are sticking with the single one), you might want to disable the physics simulation of your Static Mesh components. You can change the collision presets by clicking on the individual component and finding the Collision Presets property in the Details panel. Setting Collision Presets to No Collision ensures that it incurs the lowest physics cost possible. Make sure CollisionComponent has Pawn Preset and Generate Overlap Events enabled; if you don’t do this, in the next hour nothing will work. Also, if you disable collision of any individual Static Mesh or visual components, make sure the CollisionComponent’s sphere encapsulates your visuals.

  • + Share This
  • 🔖 Save To Your Account