Questions from a Unity programmer

Hi Guys! I’m a Unity programmer (mostly C# these days) who, after seeing all the cool things your engine can do, am thinking of getting Unreal 4 as well (I currently have Unity Free, and, let’s face it, $20/mo is MUCH more attractive than $75/mo or $1500 :P). I saw all that fancy Kismet stuff, but to be perfectly honest, I wouldn’t like to do that as much as I like to lay out my logic in code format.

  • How easy is making scripts for specific objects in Unreal 4?
  • If I walk into the engine, will it be as simple as editing scripts and attaching them to objects like I would do in Unity? Or do I have to dig into the source code to change things?
  • Can you edit all your unreal code without leaving the editor, or will I have to use an external app like Visual Studio?
  • Does Unreal have a comprehensive API with reference web page?
  • Is the coding easy to get into, or should I stick with Unity? :slight_smile:

Let’s take a theoretical situation.
Let’s say I wanted to make a jump-pad that when a player walked up to it, the jump-pad’s script launched the player.
How easy would that be/how would one go about it in Unreal?

Thank you, guys! :smiley:

Hard to answer all of these since many of us are new to this codebase and I’ve barely scratched the surface of the possibilities. UE4 does not work like Unity. The basic idea is that you start from a template. Checkout the videos such as “Intro to Programming” and it will perfectly enlighten you in that regard.

  • No, UE4 doesnt have a comprehensive API page like Unity. It just sorts of discusses the critical areas you will use like FVector, TArray, AActor, Pawn,PlayerController, Game, etc
  • Yes you will probably use Visual Studio or you will be using Blueprint.

Go to youtube, watch the videos from UnrealEngine. That’s a must

Btw, the jump pad. You’d start with an Actor, attach a touch component to detect collisions, when you get the event, you apply an impulse to the Pawn that touched you

You don’t write components and attach them to objects. You write classes and spawn them in the scene / build a blueprint from them.

That’s the biggest difference I’m fighting with atm.

The API reference is here: Unreal Engine API Reference | Unreal Engine Documentation

You don’t attach scripts to objects in Unreal. Instead, you create new classes which extend from an existing class and add new functionality that way. Unreal uses a hierarchy and inheritance.

It’s perfectly fine to nest blueprints (prefabs) though, and change their default properties and add components [to the new object].

I’m pretty sure Unity programmers will want comprehensive API Documentation like this. That doesn’t really exist on this side

Every class, interface, enum, etc. in the engine should be covered in our API reference. The Engine module alone has a ton:

We are aware some do not have the most useful descriptions, and others have none at all. And we know there isn’t any example code to accompany them at the moment. These are things we are considering and working on fixing already.

What else are we missing in your opinion? What could we do to improve it?

I’ve never seen that link you just posted. Thank you!! I was incorrect

First off, thanks for answering my questions everyone! :slight_smile: Good to know that Unreal doesn’t work quite like Unity :stuck_out_tongue:
I think I’ve seen parts of the videos on the Unreal channel.

I think your script reference would benefit from some examples to go along with the functions, and a search bar that allows you to search solely inside the coding documentation.

You have to understand that I am also what many would consider a ‘fake coder’ i.e, I haven’t don’t much delving into things (other than the C# already in Unity) so I don’t know a whole lot about ‘real’ coding :wink: The way I learned coding was actually through that Unity Script Reference (such a great resource). I used to just copy the sample code, and then eventually I began to see how it worked and then I eventually learned to make my own complex things. If I was going to get into Unreal (as I said before, I am considering) I would love it if there was a very simple tutorial that walked you through something like how to make a car setup or a simple tower defense game purely through coding (i.e light on the ‘Blueprints’ stuff) just so I could see the workflow of something like that.
So when programming in Unreal, I assume you don’t need to go so far as recompiling the whole engine. Is there a visual studio project each Unreal project comes with or something?
If you needed to add a feature to the character controller, for example, how would you go about that through coding (not blueprints)? Would you go into Visual studio, add a new class, tell it to extend PlayerController or whatever you guys use, code, and then compile the project and run? (not asking super specific, just general workflow)

Hi Stopsecret, I am also a Unity user studying the engine, but more of a programmer than you from what I read.

Unreal is different than Unity as it does not really use components but inherited classes which is a more classical way to do programming, but you don’t really need to go C++ to do something.

From the way you learned Unity I strongly suggest you ignore C++ and learn blueprints, which is definitely a great advantage for non coders, even in respect of Unity Script

It is linked off the main API reference page I linked previously in this thread, along with all of the other modules.

Like I said, we are aware of the lack of example code in the reference and are thinking about ways to remedy that. We do provide a good deal of example projects though, and these may be good sources of examples along with the engine source itself.

The search in the documentation can be filtered to only show API reference results by selecting the API tab just above the search results.

@ Wilson : Cool! Didn’t know about the API filter. I was looking around on the wiki and it like you have some pretty cool tutorials on there as well :wink:

@fred64 : Thanks, but I think I may learn the C++ anyway, I am going to college trying to get a bachelors in Computer Science, so I should learn about this stuff sooner or later :slight_smile:

Using the C++ Class Wizard inside Unreal Editor is probably the easiest way to get started adding a new class to your project, since it will handle the Unreal-specific macros and the file locations automatically. You could use the wizard to select PlayerController as the class to extend, add your code, and then compile the code in Visual Studio. Since you’d be adding a new class, you would have to re-open your project, either with the editor or by running an instance from inside Visual Studio.

There are a couple tutorials and guides that are probably good starting points to get a handle on this in practice. The Programming Quick Startis a short guide to get you up and running with compiling a game project and adding your first class. You also might find the First Person Shooter tutorial helpful, since it walks you through creating a GameMode, a Character, and a Projectile in C++ code, with Blueprints mainly used for setting asset references.

It’s new to me as well, but here is my understanding so far:

Unity:
Create a GameObject named “JumpPad”, (and likely convert into a prefab)
Add a Mesh Filter Component (your asset)
Add a Box Collider Component
Add a Mesh Render Component
Add a Script Component


public class JumpPadBehavior : MonoBehavior {
			void OnCollisionEnter(Collision col) {
				if (col.gameObject.name == "jump_pad") {
					// do something...
				}
			}
		}

Unreal:
File->Add Code to Project
New Actor named “AJumpPad”
Visual Studio opens.
Close UnrealED & Compile the project.
Reopen UnrealEd.
Create a new blueprint using AJumpPad as the base class.
Add a mesh component to the blueprint (if not already there) and assign the desired asset.
Back in visual studio, in the AJumpPad class, put


virtual void RecieveActorBeginOverlap(class AActor* overlapping_actor) override {
				Super::ReceiveActorBeginOverlap(overlapping_actor); // do the pawns' default behavior
				// now do your jump pad logic ie: moving overlapping_actor
			}

Something like that, I think.

Different, but not too different actually.

You can write new Components in C++ and add them to your Blueprints if you want! UE4 supports both composition and inheritance. It is often useful to write code in the Actor rather than as a Component though, because then it can be written with knowledge of the components, ‘tying together’ the components into a functional whole.

Thank you all for your replies :wink: I think I will try venturing into the Unreal Engine then! I think a change of pace would help me grow!