Visual Studio Snippets could be very useful, that’s why I’ve created a public repository with a few examples. Feel free to modify them and create pull requests. If you’re not familiar with pull requests, you can always paste code here and I will do it for you. Snippets are generated with doxygen style comments.

How to add snippet ?

First of all you have to clone GitHub repository. Then you have two choices:

  1. Method one. Paste .snippet files into: C:\Users\$user$\Documents\Visual Studio 2013\Code Snippets\Visual C++\My Code Snippets. Then restart VS.
  2. Method two. Open Visual Studio, navigate to TOOLS -> Code Snippets Manager… -> Import…

How to use snippets ?

Import them and just start typing ue4…
ue4 snippet
After selecting snippet from the list, hit TAB.
ue4-snippet pasted
To navigate between highlited fields you can use TAB and SHIFT + TAB. After you enter all names, hit ENTER.

Snippets

    1. ue4classa – Blueprintable class that derives from an AActor. Parameters are: comment, class name and base class name.
      /**
       * Comment 
       */
      UCLASS(BlueprintType, Blueprintable)
      class AFoo : public AFooBase
      {
      	GENERATED_UCLASS_BODY()
      
      public:
      
      protected:
      
      private:
      
      };
    2. ue4classu – Blueprintable class that derives from an UObject. Parameters are: comment, class name, base class name.
      /**
       * Comment 
       */
      UCLASS(BlueprintType, Blueprintable)
      class UFoo : public UFooBase
      {
      	GENERATED_UCLASS_BODY()
      
      public:
      
      protected:
      
      private:
      
      };
    3. ue4enum – Simple enum. Parameters are: comment, enum name, first member name and it’s comment.
      /**
       * Comment
       */
      UENUM()
      enum EMyEnum
      {
      	Name, /**< Comment */
      
      };
    4. ue4enumdisplay – Enum that can be used with blueprints. Parameters are: comment, enum name, first member name, it’s display name and comment.
      /**
       * Comment
       */
      UENUM()
      namespace EMyEnum
      {
      	enum Type
      	{
      		Name UMETA(DisplayName = "DisplayName"), /**< Comment */
      
      	};
      }
    5. ue4event – This function can be used as an event in blueprint. Parameters are: comment (parameters and return value), UI category, virtual and const modifiers, return type, function name and arguments.
      /**
       * Comment
       * @param Comment
       * @return Comment
       */
      UFUNCTION(BlueprintImplementableEvent, Category = "MyProject")
      virtual void OnFunctionName(args) const;
    6. ue4func – This function is available for blueprint logic. Parameters are: comment (parameters and return value), UI category, virtual and const modifiers, function name and arguments.
      /**
       * Comment
       * @param Comment
       * @return Comment
       */
      UFUNCTION(BlueprintCallable, Category = "MyProject")
      virtual void FunctionName(args) const;
    7. ue4interface – Simple ue4 interface. Parmameters are: comment and name.
      /**
       * Comment
       */
      UINTERFACE()
      class UFoo : public UInterface
      {
      	GENERATED_UINTERFACE_BODY()
      };
      
      class IFoo
      {
      	GENERATED_IINTERFACE_BODY()
      
      };
    8. ue4log – Simplest log line. Parameters are category, verbosity and message.
      UE_LOG(MyProject, Error, TEXT("Log message"));
    9. ue4logdeclare – Declaration of log category. Place this in main header of your project to allow logging. Parameters are: category, default verbosity and compile time verbosity.
      DECLARE_LOG_CATEGORY_EXTERN(MyProject, Log, All);
    10. ue4logdefine – Definition of log category. Place this in main code file. Parameter is category name.
      DEFINE_LOG_CATEGORY(MyProject);
    11. ue4logfloat – Log line that can be used to print float value. Parameters are: category, verbosity and variable name.
      UE_LOG(MyProject, Error, TEXT("The value of 'variable' is: %f"), variable);
    12. ue4logint – This log line can be used to log an integer value. Parameters are: category, verbosity and variable name.
      UE_LOG(MyProject, Error, TEXT("The value of 'variable' is: %i"), variable);
    13. ue4loguobj – This log line is designed to log from inside of the objects. By default, square brackets contains a name of an object that writes the log. Parameters are: category, verbosity, message and name of a pointer to the object.
      UE_LOG(MyProject, Error, TEXT("[%s] Log message"), *(this->;GetName()));
    14. ue4prop – This read/write property is available everywhere (blueprint, instance and archetype details). Parameters are: comment, category, type and name.
      /**
       * Comment
       */
      UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MyProject")
      Type Name;
    15. ue4struct – Simple structure. Parameters are: comment and name.
      /**
       * Comment
       */
      USTRUCT()
      struct FFoo
      {
      	GENERATED_USTRUCT_BODY()
      
      };
    16. ue4mark – I’m using this comment block to mark changes made to engine classes. Parameters are: Company symbol, task/ticket number, name and surname of a developer and short description of modification.
      /* BEGIN DSS (DSS-938) */
      // Marcin Polaczyk - Virtual modifier added, we need to override this method.
      
      virtual void Tick(float DeltaTime);
      
      /* END DSS */

Enjoy ! :)