can not find c++ class in the content browser

I created a c++ class.However,when i compile,i can not find it in the content browser.In the project’s vs editor,it does exist.What’s the problem?

What type of class did you create? An Actor? Component?

Have you tried restarting the editor to pick up the changes?

The class I create is a common c++ class inheriting none.I restart the editor but it still does not work.

You cannot see classes in the editor that are not marked as UCLASS().

Example:



UCLASS()
class YOURPROJECT_API SomeClass
{
   UGENERATED_BODY()
}


This is visible in the editor.

Example:



class YOURPROJECT_API SomeOtherClass
{

}


This is not visible in the editor.

1 Like

Well,Thank you, Serphimera.Then How can i create an instance of a c++ class(not inherited from Actor) in the blueprint?

Why not use a class inherited from UObject? That’s one of the very basic classes and if you don’t derive from any special third party classes you should go fine with this.

The class i create does inherited from UObject.But i can not create an instance of that class in blueprint.

I think in side the UCLASS() statement you can include a keyword to make it blueprintable, but I can’t remember what it is off the top of my head. Have a look in the source at a class that you can blueprint.

I believe what you are looking for is:
UCLASS(meta=(BlueprintSpawnableComponent))

Thanks,it works.However,another problem occurs.I defined a variable named as newVar(an instance of the predefined c++ class) in the level.Then i try to use one of the member function of the class.It failed.
The error says:Accessed none ‘newVar’ from node ‘Myprint’(the member function) in graph ‘EventGraph’ in blueprint FirstPersonExampleMap.

In order to help you effectively please post the relevant parts of your code. We must take a look at your source (how is the variable declared, how implemented, how does it get instantiated and so forth).

Lifesaver thx