Emulate Unity script Inside Blueprint class

Hi everyone,

I need to know how to emulate these code lines of Unity script inside of UE4 Blueprints :

1- creating in blue color “public class …name …” ,is that just means a blueprint class…and what does “monobehavior” means in terms of blueprint…???

2- creating in blue color "private void …name…() " , is that means a function inside a Class Blueprint …if is it a function that has no parameters or return values created … ???

3- creating in cyan color “Gameobject …name…” , is that an actor class or pawn class …???

4- creating in green color " // …do something… " is that means an Event inside blueprint class …???

and finally if the color coding in unity scripts emulates the color coding in Blueprints.

i have a random unity scripts not nesserly what i’m trying to emulate in picture below ,but that just denotes the code pieces i’m trying to understand .

Monobehavior, it’s the api, you need to understand the unreal equivalents

  1. in bp the bp is the class, as bps are visible to the level bp
  2. name?, well you have 2 function there, update and draw chessboard, so update in unreal is tick, and you can just create the function for chessboard
  3. gameobject, bps are the object, unreal’s api does not translate directly to unit and vice versa, so you need to figure out what that “game object” is doing, NOTE: pawn inherits from actor
  4. “// do something” that is just a comment, you can select nodes by dragging over them, and hitting ‘c’ and you will see a comment box appear over them

… no offense, but please take your time phrasing a question properly, to save everyone time and avoid misunderstandings

Please consult this for a proper intro: [Official Blueprint quick start guide][1]


This solves your problems at hand, but does not get you much further:

  1. Creating a Blueprint-Class:

http://api.unrealengine.com/images/Engine/Blueprints/UserGuide/Types/ClassBlueprint/Creation/CreateBP_mainFlow.jpg

  1. When you open your newly created Blueprint-Class you see this without the yellow markings:

https://docs.unrealengine.com/portals/0/images/Engine/Blueprints/Editor/UIBreakdowns/ClassBPUI/ClassBlueprint.png

Navigate to the area number 4. In the drop-down called ‘Functions’, theres a small ‘+’ on the right side, click it. The new tab that opens is where you can create your function

  1. No idea what you want to do there. I assume you want to know something like this: An Actor roughly equals a GameObject in Unity, as you can spawn and place it inside the world. A Pawn is an actor (derives from actor) that can be controlled by a player. A character is a Pawn with specialized functions for humanoid Pawns. ActorComponents can be attached to Actors/Pawns/Character (and all classes derviced from Actor), but are NOT self-sufficient, as you cannot spawn or place them in the world directly.

  2. ‘green color " // …do something… "’ is called a comment, you can create one inside the editor window by selecting a node or group of nodes and pressing ‘c’. Comments are not executed in the program and only serve for explanation purposes or todo-markings for developers. Events on the other hand are functions that have no return value. E.g. ‘void SetColor(Color NewColor);’

Hi,
Thanks for your help much appreciated.

Hi,

Thanks for your help, about (…no offense,please i’ll be more than happy to take your advice and learn from you ,thank you.)

your clarifications about my questions were enough , though i just want to wipe out some confusions in my head , just tell me if the following is true :

in the Blueprints color coding side ,

1- Blue nodes if i call a created function in a graph it will be color coded Blue ,

2- Red nodes are Events or Functions (i mean all red nodes are functions that have no return values).

3- Green nodes are functions that have no execution pins and you can only Get ( like “get center of mass” node or “Get player controller” node .).

All in all that would be correct.

Basically every node, that has an execution Pin, is a function, no matter it’s colour. Red color indicates that it’s an event/function without return.

Green Nodes don’t have an execution pin, but are functions as well. They get executed in the moment their return value is needed (you could say they have an ‘implicit’ execution pin), and are called multiple times if they are connected to different nodes (e.g. one output pin that has a connection to three different other nodes will result in the green function being called 3 seperate times.)

Lastly there are variable nodes, they are typically dark grey, and their text is the color of the variable type (e.g. an Enum is dark green, a float light green, a boolean red, …). They just give you the value of the variable and do nothing else.

Hi,
Thank you , very descriptive and precise answers ,

i just want to understand this bit : why can’t i double click on those functions whether to be Red Events or Blue Calls or Green Getters and open them and see what’s inside similar to what i can do with a newly created function from scartch !??

Is that becuase those are proprietary to the engine ??.

plus there is the Construction script which i assume it’s a special function , but i can’t call it in other graphs .

For instance here is in picture below the nodes i want to double click and see what’s inside them:

Blueprints are a visual scripting ‘language’ specific to UE4, which is displayed with nodes. The Engine itself is written in C/C++, and so are most of its built-in functions.

  1. If you cannot open a function by double-clicking, the most common reason is, that the function is implemented in C/C++, which means there is no Blueprint-representation with nodes you could see.
    The only way to look at how these functions work, would be to look at the source-code, for example in Visual studio or any other text editor:

Viewing Engine-functions like this, requires you to download the source-code from Epic’s GitHub repository, since the UE4 version you get from the Unreal Launcher has pre-compiled binary libraries (unless you can read Assembly fluently, these libraries won’t help you at all, and even if you can this would be tedious work).
2. The Construction script is indeed a special function. It is only called once, when an object is created, and this call happens automatically. It is used as a setup function, e.g. to set initial movement speed, add components to your actor, check which player this pawn belongs to and set its colour depending on the Player index, etc…

You could of course learn C/C++, but that takes a significant amount of time (months for the basics, years for experience)