C++ Battery Collector: Setting Timers for Spawning | 08 | v4.9 Tutorial Series | Unreal Engine

preview_player
Показать описание
Wrap up the spawning volume code and learn to use timers to call the spawning function at random intervals.

(00:05) - Intro
(00:16) - Creating a Timer Handle
(03:17) - Spawn Delay Range Default Values
(07:12) - Testing
Рекомендации по теме
Комментарии
Автор

This is really useful for people like me who have some base C++ knowledge but don't know how to play with UE4. Hope there can be more videos like this :)

关超宇
Автор

We need more C++ videos instead of blueprints. I started learning Unreal instead of Unity because C++ is the standard industry language for game development. So WE NEED MORE C++ TUTORIALS

saibalaji
Автор

#include "Public/TimerManager.h" for Getworldtimermanager

shadow-ttdx
Автор

It sounds like a cat is purring into the microphone the entire video. Very relaxing! :D

Vergbergler
Автор

This was so satisfying to see work! Thank you so much for the tutorial.

NeonFraction
Автор

use GetWorldTimerManager you need #include

肖豪-rc
Автор

If you are using 4.22.3 (or newer) version of the engine then the GetWorldTimerManager() function will probably not work for you (It did not work for me even with the includes mentioned in the comments here). Use GetWorld()->GetTimerManager() instead. Having that in mind the line of code used in this tutorial for setting the timer should look more or less like this:

GetWorld()->GetTimerManager().SetTimer(SpawnTimer, this, &ASpawnVolume::SpawnPickup, SpawnDelay, false, SpawnDelay);

korny
Автор

I had a problem that could be used as advice for anyone else having the same problem, my SpawnVolume was not spawning anything and the code was ok, it happened because i selected the cpp class (BatteryPickup) to be the WhatToSpawn, when i should have selected The BLUEPRINT of the cpp class (BatteryPickup_BP).

ChenWuLong
Автор

In the OOP (in most cases) if you can calculate it, it isn't an atribute so SpawnDelay should be calculated in the moment you require, in this case on SpawnPickup().

jesusallerdiez
Автор

I do want to point out that the UPROPERTY(EditWhere, BlueprintReadWrite, Category = "Spawning") can't be placed in protected and must be in public.

Something about a change in the newer updates

geoffreysender
Автор

So I've got pretty much every right (from what I can tell) up until about @7:40 when the Spawn Volume is dragged out into the viewport. I can drag mine out but i don't see any transform controls. I also can't see the transform menu in the details panl, and the only thing in Spawning is "Where to Spawn" but it's all grayed out. It's not like it fully compiled, but when I do compile both in Visual Studio and the Editor, it says it compiles properly. I'm not too sure what to do from here so any help would be greatly appreciated! Thanks!

Chggns
Автор

I am not sure if i understand. When to create blueprints of cpp code and when to directly use cpp code in editor (like shown in video)

gokusaiyan
Автор

*Sigh*, for every video I get "incomplete type is not allowed", and most of the times the comments tell me what to include to fix this. 1) Why doesn't she get the same errors? 2) What do I have to include to get that error away from the "GetWorldTimerManager()"? 3) What can I do to avoid this in future cases? Do I always have to search documentation to find out what class owns this and that function or what file declares them?

kennethkrist
Автор

For the one watching in early 2020 to use GetWorldTimerManager() you need to #include "TimerManager.h"

vojinmilovic
Автор

Anyone else who had problems here? I'm able to compile but when I press "play" there are no random spawnings, there happens just nothing.

BenHdbngr
Автор

Someone told me programmers make good money, but when I press compile no money comes out.ehh I'm not funny. anyway. What does "this" point to here? GetWorldTimerManager( )? Just trying to figure out why "this" was used here..its the address of the calling object right, so why is that passed to SetTimer.

ChristopherJones
Автор

Can someone advise me a book or article about this C++ stuff starting from this video up to the end of series? So much functions and properties, I am a little bit confused, hard to move forward.

yaroslav
Автор

Why do wo copy that SpawnDelay and SetTImer() block to the function SpawnPickup()? Is there a special reason for that?
I find it kinda counterintuitive, why not just set the loop parameter (the last one) in SetTimer() in BeginPlay() to true, isn't that exactly what it's meant for? Works exactly the same for me.

kairostn
Автор

Well, I think you should have a fair amount of experience with C++ before you try this.

I don't even have the barebones of C++ experience, and minimal C# experience (i.e. simple 2D games in XNA). I'm pretty much lost, so many functions called in, and the syntaxes used gets confusing.

So, this appears to be pretty much useless for a complete beginner, which should maybe have been obvious to others. You can sorta follow the first few videos, but then it escalates really quickly.

muuubiee
Автор

when i press play it doesnt random rotate. i have no problem on other functions
please help

Senyo-fj