Hi there!
I’m having trouble compiling a simple character I wanted with a prebuilt set of variables within a struct I could access to.
This is my code:
The compiler keeps saying “FMyCommand isn’t a class name or namespace” and “Identifier not declared”. What am I doing wrong? Am I supposed to name my struct in a very specific way or something?
Structs are like Classes, in fact they work very similar, both are skeletons which can contains properties and functions. There for class and struct declaration can’t be contained as property of another, so place your struct outside any class and in the class make a property using struct as a type of your object Best would be if you declere your struct in header file
That won’t help… you can define a struct variable starting with the keyword struct. This is actually how you have to declare them in C (which is why you find a lot of typedefs for structs in old code).
Yeah, that doesn’t seem to work either.
Isn’t there any example out there of a struct being used in a class? It’s kinda embarrassing that I can’t get a simple struct compiling properly.
For some weird reason that seems to compile properly. I guess that there’s some rule telling the compiler not to compile variables with a certain name…
However, even after compiling I can’t access the struct from my blueprint. Is there any parameter or anything I need to add to be able to access it?
I do need to access it from the blueprint. I want to make my character have a “equippable” attacks from a menu to use in-game, and organizing all the information for each attack in a struct would be the way to go in my opinion. However, if I use a regular struct I can’t access it from the blueprint system, can I?
EDIT: Nevermind, I actually just got it working. I can just use the Break node from the blueprint system.