Announcement

Collapse
No announcement yet.

Class which was marked abstract was trying to be loaded.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Class which was marked abstract was trying to be loaded.

    Hi everyone! I wrote simple code:

    .h
    Code:
    class HORRORGAME_API AScreamSystem : public ACharacter
    {
    	GENERATED_UCLASS_BODY()
    
    	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=MeshTrigger)
        TSubobjectPtr<class UMeshComponent> meshTrigger;
    
    	void Tick(float DeltaSeconds);
    };
    .cpp

    Code:
    AScreamSystem::AScreamSystem(const class FPostConstructInitializeProperties& PCIP)
    	: Super(PCIP)
    {
    	meshTrigger = PCIP.CreateDefaultSubobject<UMeshComponent>(this, TEXT("Mesh"));
    }
    
    
    void AScreamSystem::Tick(float DeltaSeconds)
    {
    	GEngine->AddOnScreenDebugMessage(1, 10, FColor::Green, "Hello, world");
    }
    I don't have errors but Visual Studio doesn't compiles it

    In log:
    Class which was marked abstract was trying to be loaded. It will be nulled out on save. Mesh MeshComponent

    What should I do?
    Last edited by KaspiProject; 11-17-2014, 03:23 PM.

    #2
    UMeshComponent is an abstract class - see the documentation and you will see it starts with UCLASS(Abstract).

    This means you must first create a subclass of UMeshComponent and use that as your meshTrigger.

    Comment


      #3
      Originally posted by Tarostar View Post
      UMeshComponent is an abstract class - see the documentation and you will see it starts with UCLASS(Abstract).

      This means you must first create a subclass of UMeshComponent and use that as your meshTrigger.
      Please write me example

      Comment


        #4
        UMeshComponent is abstract class, which cannot be instantiated, so you need to create derived class instead, which itself is not abstract:

        As an example:
        Code:
        meshTrigger = PCIP.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("MESH"));
        You can see all derived classes in documentation.
        Programmer working on Creach: The Depleted World game!

        Comment


          #5
          Thank you!

          Comment

          Working...
          X