Components or Actors or Classes or Blueprint Classes

Hi everybody ,

dumb question alarm here :cool:

i have a big confusion here , basically an Actor is whatever you put into the level, but a class is a blueprint that you create and have components attached to it ,

1- A static mesh Floor_400x400 already has component "StaticMeshComponent " attached to it ,when you add it as a component to a random Buleprint “Floor” (see pictures attached) ,…

…So in the components panel shouldn’t be a Component called “Floor_400x400” that has in turn the Component called "StaticMeshComponent " at the first place attached to it ,??? .

2-What i noticed when you drag a point light from the Modes panel it gets added as an Actor into the world but when you read the description if you hover over point light Actor name in the details panel (see pictures attached) ;…

…it says is a “class” and its parent class is "light " , but shouldn’t this be an actor a second ago and not a blueprint cause i don’t see it color coded blue you have to convert it first via the blue button above then you can call it a class i assume ,

more confusing its component which is PointLightComponent (Inherited) says " Inherited C++ Class ", but shouldn’t only Scene component and actor component be blueprintable components that you can add to Actors as components at first place.

Your description is quite confusing, but no worries.

A “class” is a term used in programming, and pretty much everything in Unreal is a class. Classes can be created both in C++ and Blueprint.

An “Actor” is a class called “AActor” (the first “A” is silent and refers to its type as “Actor”). The top-most level in Unreal is a “UObject” (“U” standing for Unreal Object), and AActor inherits from that as a child class. Any class with the prefix “A” (so “APlayerController” for example) is an object, Actor, that can be placed in the world. Any class with the prefix “U” is a standard object that cannot be placed in the world.

A “component” is a part of an Actor. A SceneComponent has its own transform within an Actor, while an ActorComponent only adds behavior.

In your screenshots, the PointLight is an Actor that contains the PointLightComponent that is the actual point light. The Floor object is a Static Mesh Actor that contains a StaticMeshComponent that holds the actual 3D mesh, materials and other properties. In these cases, the Actors just “wrap around” the Components so you can place them in the level. If you create your own Actor class, you can add any number of components. So for example a light fixture would have a StaticMeshComponent that has the 3D mesh and material for the visible fixture, and a PointLightComponent so it emits light. This way, you only have to place that one Actor in the world to have a working lamp, as opposed to manually placing each Static Mesh Actor and Point Light Actor.

2 Likes

Hi,

Thank you much appreciated , a very descriptive answers ,

Though the problem is my head , i can’t wrap my head around the terminology i mean can’t they just made it simpler than that , So if a class could be a C++ Code ,

1- is that mean the C++ source code responsible for creating all we see in the editor from the UI to the gameplay ,The Components are just extending upon that , i mean the proprieties in the details panel of a component like pointlight : changing light color and intensity are actually C++ classes themselves .

2- If So when i place an empty actor from Modes tab i still see some basic proprieties like transforms even though i didn’t attach any components to it yet .

3- and what about the Root Component is it a child class of Scene component or the other way around .

Sorry but i spent almost a year learning the UE4 engine aside from my university studies and i feel like i know a lot about it until i came across this Class thing which looks suddenly everything want to be a class …:eek:

4- I’ve seen C++ code before but never came across this terms like Uworld Uobject is that mean you have to learn 2 Languages the first beeing C++ itself then C++ with proprietary UE4 engine terminology like “AActor” So you can understand what those classes came from .

1 Like

Okay, I’ll try to go through it:

1 - Basically, yes. The entire engine is written in C++ as are many other applications. It’s one of the industry-standard programming languages. And yes, components are classes themselves. As a programmer, the most commonly-used method is “Object-Oriented Programming” (Google it if you don’t know what it is, basically, search for any terms I use here if you don’t know what they mean, it takes way too long to explain them all). OOP means you “inherit” from one class to add additional functionality for a new more specific class. So in UE4, UObject is the highest class, followed by AActor which “inherits” from UObject (making UObject the “parent” of the “child” AActor). Then SceneComponent is a child of AActor, and ActorComponent a child of UObject.

2/3 - The Root Component is by default an empty SceneComponent and is responsible for giving the Actor its transform properties. It’s not a class but a variable within AActor, which by default automatically creates an empty SceneComponent. The Root Component is responsible for the transform of the Actor as a whole. So in the Static Mesh Actor, the Static Mesh Component is the Root Component and handles the transform for the Actor. The same applies to the Point Light.

4 - They’re not technically two languages. It’s still all C++. However, Unreal Engine has an “API” (Application Programming Interface). This is basically nothing more than a collection of classes (UWorld, UObject, AActor, etc.), types (FString, FVector, etc.), macros (TEXT, GENERATED_BODY, UE_LOG, etc.), and libraries of functions, that are implemented in the engine and can be used by programmers to build a game without having to write really low-level code. This way you don’t have to go very deep into the core of C++ code to create games, which is the whole point of using a game engine.

I understand it can be difficult, it took me many years before understanding code as well, let alone C++. The irony is, is that this makes it simpler than using plain C++. In fact, it’s Unreal’s API that allowed me to better understand C++ in general, even though I can’t hope to build anything with C++ alone. Remember, most of this isn’t specific to UE4, but rather C++ itself. “Classes” are the most basic thing in programming languages like C# and C++. I suggest picking up a book, either about general C++, or about C++ in UE4 if you want to work with UE4 specifically. Believe me, those are invaluable to have. I also recommend reading about Computer Science if you’re really interested in programming in general. That really deals with understanding computers, which is important as C++ isn’t called a “language” without a reason.

2 Likes

Hi,

I can’t thank you enough for your descriptive answers , much appreciated …thanks again for a very informative details , …

…One last thing ,actually i’m trying to make a Chess game that’s why i was asking about components , though i need some advice ,So please …please take a look at my process provided below and if possible these are the points i need help with :

1- how to switch chess pieces between Dark turn and Bright turn based on the freedom of starting initially the game with whichever piece you like …??

2- How to Set allowed moves for a given chess piece relative to its current position on the board , i know that could be done with traces by channel , but the piece moves during the game to different places so do i have to line trace or sphere trace by channel all directions on the chess board from the piece’s position and check for the all types of chess pieces if we hit any then script the behavior for it but that would be tedious…:(…

… i mean depending on chess rules there is alot of different situations at once to account for , or is there methods to make this achievable with reasonable amount of blueprint scripting …???.

3- below in pictures you see how i’m doing everything in the construction script of the actor class which is the entire chess board at once with the pieces being set as components and inside i have a function called Click which is responsible for driving the clicking on the chess pieces and it is called inside event graph of player controller …but then i thought why not take more control …:cool:…
…and make the chess pieces seperate as pawn classes and children of the chess board then i’ll make a knight a pawn and each of the other 3 knights children of it …and so on to inherit functionality from the parent pawn… what do you think is it the right way down the road …???..

Thank you for your support .

below are pictures of all the graphs the ChessBord blueprint have the Construction script (picture_1) and Function called “Click” (picture_2) , then the controller player (picture_3) which only calls the function “Click” by way casting , i’m explaining the construction script with writings (on the picture_1) .

–Note :
i’m assigning one side a dark material “Pieces_Dark " , and the other side bright material " Pieces_Bright” ( this is just a naming convention to differentiate them from the tiles of the chess board being “Fields_black” and “Fileds_white” ).

the nodes in the comment box (boardalphanumeric automated i was just trying to tie a1,b1,c1…g8,h8 . strings to the mesh pieces . but i found out that it will be diffucult down the road to set the allowed the moves with an alpha numeric system , rather prefer the fact that i can just rely on indexes 0…63 of the loop creating the floor 400*400 meshes representing the tiles meshes of the chess board to get references easily for the board tiles …a bit dumb but you know i’m learning… :slight_smile: . …i just want it like realistic chess when they refer to the pieces positions “i moved to h7” or “i’ll capture the knight on b4” and so on …

…NumericLables and alphaLables arrays for automating the process of creating alphanumeric labels and the array "StartFigures " for the initial positions of the chess pieces on board during construction script are shown at last .