title: TSubclassOf<> isn't storing the class type
body: <p>I'm trying to create a laser beam actor that spawns when the player presses the "Fire" action mapping. I can't get TSubclassOf&lt;> to work so that I can spawn the actor that creates the laser. I can declare the variable and compile the project, but I can't seem to use the template anywhere else in the project because the variable isn't initialized??? I'll include my code to help explain what's happening.</p>
  
  <p>Here is my LaserTagCharacter.h file. I've declared the LaserClass variable and I can compile this code with no problems.</p>
  
  <pre><code>#pragma once
  
  #include "CoreMinimal.h"
  #include "GameFramework/Character.h"
  #include "LaserTagCharacter.generated.h"
  
  UCLASS()
  class LASERTAG_API ALaserTagCharacter : public ACharacter
  {
      GENERATED_BODY()
  
  public:
      // Sets default values
      ALaserTagCharacter();
  
      UPROPERTY()
      TSubclassOf&lt;class ALaserTagLaser&gt; LaserClass;
  
  protected:
      // Called when player fires a laser beam
      void OnFire();
  };
  </code></pre>
  
  <p>Moving over to the LaserTagCharacter.cpp file, I've included some debug code and my main objective with creating the template class. I created the template class to use it in a SpawnActor function that will spawn an instance of LaserTagLaser.</p>
  
  <pre><code>#include "LaserTagCharacter.h"
  #include "Camera/CameraComponent.h"
  #include "Components/CapsuleComponent.h"
  #include "Components/InputComponent.h"
  #include "LaserTagLaser.h"
  #include "Engine/World.h"
  
  // Sets default values
  ALaserTagCharacter::ALaserTagCharacter()
  {
  
  }
  
  // Called when player uses fire action binding
  void ALaserTagCharacter::OnFire()
  {
      UWorld* World = GetWorld();
      FVector SpawnLocation = GetActorLocation();
      FRotator SpawnRotation = GetControlRotation();
  
      if (LaserClass)
      {
          UE_LOG(LogTemp, Warning, TEXT("Yes"))
      }
      else
      {
          UE_LOG(LogTemp, Warning, TEXT("No"))
      }
  
      World-&gt;SpawnActor&lt;ALaserTagLaser&gt;(LaserClass, SpawnLocation, SpawnRotation);
  }
  </code></pre>
  
  <p>The 2 messages I get from the output log when I compile, play, and press the "Fire" action mapping are:</p>
  
  <blockquote>
    <p>LogTemp: Warning: No</p>
  </blockquote>
  
  <p>and...</p>
  
  <blockquote>
    <p>LogSpawn: Warning: SpawnActor failed because no class was specified</p>
  </blockquote>
  
  <p>If you have any insight on how I can fix this and get TSubclassOf&lt;> to work properly, that would be awesome!</p>