Announcement

Collapse
No announcement yet.

C++ Classes not showing up in content browser

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

    C++ Classes not showing up in content browser

    Hello all,

    I'm admittedly quite a newbie when it comes to dabbling in C++ and hence, am attempting to remedy this.

    On my journey to learn about using C++ classes and scripts in UE4, I decided to start with this tutorial:

    https://docs.unrealengine.com/latest...t/4/index.html

    I, to the best of my knowledge, have followed it exactly. I'm getting stuck however, on the step where it shows the content browser. Theirs looks like this:
    Click image for larger version

Name:	Image1.PNG
Views:	1
Size:	85.6 KB
ID:	1211878
    Mine, however, looks like this:
    Click image for larger version

Name:	Image2.PNG
Views:	1
Size:	14.8 KB
ID:	1211879
    I did a lot of google searching on the issue and found numerous older topics nearly identical to mine, but no resolution that seems to work. I simply cannot seem to get my C++ FloatingActor class to show up in the content browser, nor can I go backwards any further in the hierarchy than the Content folder by pressing the left arrow.

    My code looks identical to that of the tutorial:
    Code:
    // Fill out your copyright notice in the Description page of Project Settings.
    
    #pragma once
    
    #include "GameFramework/Actor.h"
    #include "FloatingActor.generated.h"
    
    UCLASS()
    class QUICKSTART2_API AFloatingActor : public AActor
    {
    	GENERATED_BODY()
    	
    public:	
    	// Sets default values for this actor's properties
    	AFloatingActor();
    
    	// Called when the game starts or when spawned
    	virtual void BeginPlay() override;
    	
    	// Called every frame
    	virtual void Tick( float DeltaSeconds ) override;
    
    	float RunningTime;
    	
    };
    Code:
    // Fill out your copyright notice in the Description page of Project Settings.
    
    #include "QuickStart2.h"
    #include "FloatingActor.h"
    
    
    // Sets default values
    AFloatingActor::AFloatingActor()
    {
     	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    	PrimaryActorTick.bCanEverTick = true;
    
    }
    
    // Called when the game starts or when spawned
    void AFloatingActor::BeginPlay()
    {
    	Super::BeginPlay();
    	
    }
    
    // Called every frame
    void AFloatingActor::Tick( float DeltaTime )
    { 
    	Super::Tick( DeltaTime );
    	FVector NewLocation = GetActorLocation();
    	float DeltaHeight = (FMath::Sin(RunningTime + DeltaTime) - FMath::Sin(RunningTime));
    	NewLocation.Z += DeltaHeight * 20.0f; //Scale our height by a factor of 20
    	RunningTime += DeltaTime;
    	SetActorLocation(NewLocation);
    }
    It's the same place as theirs in the Solution Explorer in Microsoft Visual Studio:

    Click image for larger version

Name:	Image3.PNG
Views:	1
Size:	16.3 KB
ID:	1211880

    It compiles without issue. I've compiled it both in Visual Studio as well as Unreal. I've restarted the UE4 engine as well. I've looked at other forum threads, but nothing they've described seems to yield a solution that allows me to see my C++ classes in the content browser.

    Does anyone see something I'm missing, or know how to remedy this?

    #2
    Try putting the files you've written in a folder inside QuickStart2, for example:

    Source/QuickStart2/SpecialFolder/FloatingActor.cpp etc

    You can't see QuickStart2.Target.cs in the editor, so I assume it ignores anything in that directory, and only shows things in subdirectories.

    Comment


      #3
      Hmmm, that would make sense. I just tried it, however, and I'm still getting the same issue.

      Click image for larger version

Name:	Image10.PNG
Views:	1
Size:	18.5 KB
ID:	1123859

      Click image for larger version

Name:	Image11.PNG
Views:	1
Size:	65.4 KB
ID:	1123860

      Comment


        #4
        In View Options (eye icon) make sure you displaying C++ classes. You can find your class in Create New panel if you search by name as well... cheers.

        Comment


          #5
          Originally posted by Predatoria View Post
          [ATTACH=CONFIG]130658[/ATTACH]
          You need to click icon with 3 stripes and cursor above them to expand side panel as well It is to the left of "Filters" in this picture.

          Comment


            #6
            The first time for me was the same. But the first time I also got an error that I needed to install Windows SDK 8.1. Done that, but this problem showed up later.

            So... I just created a brand new project and redid all the (3?) steps and voila, it's there. It should be visible just after you've added the C++ class.

            Comment


              #7
              C++ classes can appear in the content browser, but are not considered "content". Yes, a very confusing usage of terminology by the Editor.

              In the content browser, you should see the word "Content" in bold with a folder icon to the left and a triangle to the right. Click the folder icon and select "C++ classes", then click the name of your project. You should then be able to drag the class into the level (if it inherits from Actor).

              It's unfortunate that C++ classes do not show up in the default view.

              Comment


                #8
                Click on the folder icon in the top of content browser.. it will open a new window.. check for c++ class folder in .. touche!!!

                Comment


                  #9
                  I found the solution. @ 4.18, there's view option on the content browser and tick the box of "show c++ classes".

                  Comment


                    #10
                    I have the same problem in 4.22.3 and i have c++ classes visible by default.
                    I created a new 4.22.3 Project (non C++) and added my Sourcecode to it which is working in 4.21 and compiles in 4.22.3 successfully.
                    However, my classes are not exposed to the Editor and Content Browser.

                    Comment


                      #11
                      I have this problem - for the life of me I cannot figure out how to get C++ classes to show! Have rebuilt everything in VS many times.

                      Comment


                        #12
                        For those arriving here --

                        I don't have the defacto solution, but if you have a C++ class (or several) not showing up, make sure that the relevant .h files are in the /Public folder. If you don't have one or know where that goes, create a public C++ class and navigate to that.

                        Comment


                          #13
                          Originally posted by makai View Post
                          I have the same problem in 4.22.3 and i have c++ classes visible by default.
                          I created a new 4.22.3 Project (non C++) and added my Sourcecode to it which is working in 4.21 and compiles in 4.22.3 successfully.
                          However, my classes are not exposed to the Editor and Content Browser.
                          What works for me when I create a non C++ project is:
                          1. Close Unreal Engine
                          2. Open C++ project
                          3. Run the project through the IDE
                          Using VS Code as an example
                          1. Debug Panel > Generate Project Files
                          2. Uncheck Beakpoints > C++: on throw
                          3. Debug Panel > <ProjectName>Editor(Development) (<ProjectName>)
                          4. After the Unreal is loaded you can stop it and open the project using Unreal normally

                          Comment

                          Working...
                          X