Hey, everybody.
I would like to ask if it makes sense to make a separate file and declare macros there and use them by code?
File Example:
Usage Example:
Thx.
Hey, everybody.
I would like to ask if it makes sense to make a separate file and declare macros there and use them by code?
File Example:
Usage Example:
Thx.
All depends how much and where you use them, ideally you wouldn’t want to include things in places they are not needed as it’ll make the file size and memory usage larger, not by much if it’s a small enough macro library
My general rule of thumb would be if it’s useful do it
But say you include a macro for determining how many coins you have in a door BP and then you have 100s of doors… in that case it would be wasting some amount of memory, so in essence you’d only want Coins or perhaps the player to have the code to calculate the value of said coins
With a small macro the problem is hardly noticeable but if you have a very large macro the problem only becomes more obvious
TLDR: Don’t make a macro library for everything only the classes that will use most of the macros within it
All right, thanks for the reply
And one more question on this topic
is it possible to make a macro like this and use it:
#define STRUCT_PROPS EditAnywhere,BlueprintReadWrite
USTRUCT(BlueprintType)
struct FSomeStruct
{
GENERATED_BODY()
UPROPERTY(STRUCT_PROPS)
float SomeFloatVar;
};
Does it even make sense to do that or is it a bad thing?
Thx.
i mean it looks like you did? does it work lol
i don’t see why it wouldn’t just thinking about it but I’ve never tried myself
i imagine it’s rather similar to unreal using the keywork UPROPERTY to do the stuff they do behind the scenes