Could I get some clarification about spawning actor classes?
I have some doubts regarding spawning an actor.
I read https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Actors/Spawning/index.html but still got a few doubts.
E.g. here is a code from the 1st person shooter sample.
Here AMyProjectProjectile is the class of the actor which is spawned. What is other ProjectileClass here?
AMyProjectProjectile is in so called template, it makes spawnactor funtion return instance or that class insted of actor class which it does by default (withou this template). It also sets type of first argumet of that funtion so you cant place refrence of parent classes which may not be able to be casted to target classs in template.
And ProjectileClass is a refrence of class varable which conatins info of class thet needs to be spawned and is a child of AMyProjectProjectile because templated set before thet force you to. C++ does not support class refrenceing, you can't keep class type in varable, there for UObject system in engine got pseudo solution for that which is UClass class which is refrence of a class, ID card of class you could say, so classes is identified by the engine by collection of uclass objects. Thanks to that you can place class refrence in to varable or put it in funtion argument like in this case. You can get class refrence of any UObject releted class by this statment ASomeActorClass::StaticClass ()
answered Apr 23 '14 at 05:10 AM
From the FPS C++ tutorial:
If you look at the blueprint for your projectile that you will be creating, there should be a 'Projectile' section where you are able to set the class to be used. Or you can look into loading the class/blueprint in your constructor.
answered Apr 22 '14 at 10:19 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here