x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Just switched from Unity to Unreal - Completely lost with C++ and so confused

Let me start out by saying I am well experienced with C# in Unity, in case anyone thinks I should use blueprints. To be completely honest, I don't like blueprints. That is, using it for everything. But I want to start out simple and there are no C++ tutorials. Am I the only one in the world who prefers C++? No one has a decent tutorial that explains what things are doing, they all just type and type and don't explain what each line of code is doing. Not only that, but with Unity it's so much easier to get help. You just google, "Unity player movement" but when I google it for Unreal I get either blueprints or demonstrations of someone else's character controller.

Can someone point me in the right direction to get started with Unreal C++?

Product Version: UE 4.10
Tags:
more ▼

asked Feb 05 '16 at 01:01 PM in C++ Programming

avatar image

AWPlays49
32 9 16 21

avatar image FilipeTessaro Feb 05 '16 at 01:17 PM

I understand you, because I started with Unity too (learning Java, actually), and the video tutorials there are very good, indeed.

I´m trying to learn C++ too, but there is no good videos for begginners, I mean really beginners...

The staff created this serie: https://www.youtube.com/playlist?list=PLqU6tIWZfnm4V066mWKkSti0RQmC2nMrw

But as yuo said, it is a little hard to understand, too much typing, but try this one if you didn´t see it yet.

Hope the Staff can help us about that.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

We have a couple of documents to help people transitioning from Unity to UE4:

The links above explain the UE4 equivalent terms, classes, and functions for someone coming from Unity, and include both C++ and Blueprint examples.

You may also want to check out our general programming guide, as well as our introduction to C++ programming in UE4 guide, and C++ programming tutorials.

In terms of learning how to create more complex features, we have a number of example projects available (both in C++ and Blueprints) that demonstrate a variety of engine features.

Hopefully this helps you get started, but if you need help on a specific feature then please feel free to ask on AnswerHub or the Forums and someone will likely be able to help you further.

more ▼

answered Feb 05 '16 at 01:20 PM

avatar image

Jamie Dale STAFF
7.5k 176 66 304

avatar image AWPlays49 Feb 05 '16 at 01:31 PM

Wow this is great, thanks!!!

avatar image AWPlays49 Feb 05 '16 at 03:27 PM

Hey sorry to bother you again, but I'm still confused on the whole syntax. How can I access my components such as my transform in C++?

Also I have this script:

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #include "Test.h"
 #include "PlayerControllerInput.h"
 
 UPlayerControllerInput::UPlayerControllerInput()
 {
     PrimaryComponentTick.bCanEverTick = true;
 }
 
 void UPlayerControllerInput::BeginPlay()
 {    
     Super::BeginPlay();
 }
 
 void UPlayerControllerInput::Tick(float DeltaSeconds)
 {
     Super::Tick(DeltaSeconds);
 }

and this header:

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #pragma once
 
 #include "Components/InputComponent.h"
 #include "PlayerControllerInput.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class TEST_API UPlayerControllerInput : public UInputComponent
 {
     GENERATED_BODY()
 public:
     UPlayerControllerInput();
     virtual void BeginPlay() override;
     virtual void Tick(float DeltaSeconds) override;
 private:
 
 };

yet it doesn't recognize the function Tick.

avatar image mikepurvis Feb 05 '16 at 06:34 PM

It's possibly not being used. Did you set a breakpoint at BeginPlay and confirm that this input component is being used at runtime?

You can always rebase a blueprint to C++ at a later date if you want to move some of it's functionality into code later. I find Blueprints easiest for dealing with in level and in game assets. I find C++ much easier to debug than blueprints.

avatar image AWPlays49 Feb 05 '16 at 08:29 PM

For some reason when I made a new file that was written completely the same, it started working. But I got this error saying it wouldnt be shown in the browser, and even though it is a uclass, it wont show up? @mikepurvis

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Using Blueprint to begin with is the best way to familiarize yourself with the API. You'll learn Unreal and C++ in Unreal faster if you Blueprint for a while first, as opposed to jumping straight in.

Blueprint is designed to be used in conjunction with C++, so don't write it off. See ShooterGame for example. Even the most hardcore C++ programmers usually prototype in Blueprint first.

more ▼

answered Feb 05 '16 at 01:26 PM

avatar image

TheJamsh
815 59 97 140

avatar image AWPlays49 Feb 05 '16 at 01:31 PM

You have a good point. Maybe I'll open up a little more to blueprints, but the problem is no one uses C++ on youtube :(

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

There are a couple possibilities for what is going on.

First though. What do you need to extend the InputComponent for?

What version of the Engine are you using?

You are using a constructor, which isn't necessary, but, if it is used you need to use the FObjectInitializer. Here is a link to a thread discussing it: forum link

Here is the document on InputComponent: Doc Link

I'm not sure that this tick is being called on this, you may need to extend FTickableGameObject, not sure since it's a component. PlayerInput is what manages these and it looks to be purely event driven. link text

more ▼

answered Feb 06 '16 at 01:53 AM

avatar image

mikepurvis
2.5k 102 66 261

avatar image AWPlays49 Feb 06 '16 at 12:50 PM

Im sorry for the delayed reply.

I dont really know what is going on when I open the engine. I want to make everything from scratch, but Im so confused as to why I have a player moving around in my brand new project when I really haven't done anything.

avatar image mikepurvis Feb 06 '16 at 08:29 PM

There is no starting from scratch. Even if you just used straight C++ with OpenGl or Direct X you would not be starting from scratch and a GameEngine is a lot more than just a graphics library.

Start with a blank project if you want next to no built in gameplay, such as just look around but no move.

At first I thought you wanted to extend the inputcomponent because you were adding an unsupported device. But, I don't think you actually have need to extend that component, it does a binding between the hardware input and the controller. If you were extending it, it would be to make some sort of changes in how the binding worked. In my short look at it, it appears to have nothing to do with processing the input and acting upon it in a unique way.

Also, it is event driven and not necessarily going to be doing something every tick.

What I think you are looking for is to do is capture the input and then handle it yourself.

For that, you don't need any custom input.

Get the HandleInput events in the controller and then act on them as you want.

Here is the documentation on setting up a character, if you scroll down you will see how it captures input events and then controls movement from them. If you want to move different, or do something else with the input you are free to.

Character Setup Link

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question