So the Tsubclass I know how this function, I have used it before, to spawn other actors to bring in actors so I can attach them to socket and so on.
When you create a new Actor class (either C++ or Blueprint) from within the Editor, you automatically create a subclass of the Actor class. In Blueprint, it tells you the parent class in the top right corner. In C++, near the top you will see something like
class AChildClass : public AActor
.
So it’s a subclass, this is what I wanted to know, so Myactor2 class is a subclass of the main Actor class.
When you spawn an Actor (using the SpawnActor node), you are not creating a subclass of the Actor class, you are creating an instance (aka an object) of the Actor class.
When I am not creating a class you mean and just spawning ? then yes I agree.
So now we got the ActorClass and ALandscape is part of the actor class.
Now strange tho it is under the actor class and the actor class should be it’s parent meaning Actor.h
the Landscape class all tho part of the Actor root folder class it’s not part of the Actor.h but Landscape.h
So this landscape class is a class within the actor class but sort of it’s own parent.
So when trying to create a child class, that is derived class from the Landscape class , based on the Landscape class right , well it cannot be created and throws errors, I made another thread about this. This is not the place.
So since I can’t create this class that is a child of the Landscape class then I want to go around here and use Tsubclassof to get access to Landscape.h.
But strange enough parent class Landscape.h is it’s self under the actor class, how come ?
So the question is anyway, can I use the Tsubclass on this parentclass, and get data from this parent class by refrencing the class with Tsubclass .
is the TsubclassOf only suppose to work with subcasses ? can we include parent class and is this recomanded to use it like this, to get all of the class variables, functions and data thru this type of refrencing, maybe I don’t know I may get some problems later for doing this. Can I even get access to landscape class I hear it’s minimal api but others got access to it’s functions, I have seen it, there are books and so on, but maybe that was a long time ago and it’s no longer possible.
So this is my other thread.
How to add a class derived from ALandScape class - Development Discussion / C++ Programming - Unreal Engine Forums
This is why I created this one, to find another way to that class since that solution is not working, I think you get the idea now.
Is it really recomended to use this TsubclassOf to get in all the functions and variables of the other class that is tied to the module I want stuff from, I haven’t tried but I could, would it even work, will it refrence the main Landscape.h class, what is this class, is it a parent class, or it a smaller parent that belongs to the actor class, if I somehow manage it to work would I not get surprises in the future.
Thank you, if you or anyone can help me.