Download

Newbie have some question

hi i’m not programmer but BP make me can make game! thank you vvvery much
because i have no program knowledge and use only BP , recently i have some questions expecially optimazation , performence things

1.Which one is better just always doing some action(set variables , set umg , call function…) and using branch so don’t do that action if already have action’s result?
is it waste of memory to set value A what is already A? (Does UE automaticcaly judge “Oh it’s already have same result, this action means nothing. I don’t have to do that” or not? )
but i think branch also need memory to check condition
how should i do?

2.is it bad to have too many output in function and macro?
i’m using same function to many other case which need different input
so just ouput all thing and use only need node but is it better seperate function?
like 1 qusttion does function just always oupt all thing and need cost for each of them or just connected one only?

3.Spamming promote to variable is bad?
I have many UMG and almost all of them do get pawn,cast pawn,promote pawn…
and many many reference for communication UMG to UMG
is there a better way?

Sorry, I think you might need to give some examples… :slight_smile:

1 - Yes we need exemple.

2 - Yes it’s better to separate, it’s better for you too for readability, performance wise, it depend of your functions but each time you create an output you use memory. If you have one func that is often use and with a lot’s of output you’ll spend memory more than what you need if you use only one of these.

3 - It’s maybe a personnal answer and it can be discuss but for me : I prefer use function, for exemple when i need to get a singleton actor, i do it in a BlueprintFunctionLibrary and call that func where i need. The reason is if i need to change the way i get it, i can do it for the whole project just at one place. Once the game is ready to publish i look at processor/memory uses and at this time i create variables if needed, it’s always easyer in this direction (free up memory be replacing by func is harder in a project).


like this
is red section unusefull?

wow this is cool

I think this check is already done internaly in the SetVisibility function but nothing sure, i would not use this here, just set visibility for readability because some day you’ll ask yourself why this is here (in this case you’ll understand instantly but i prefere not complicate my BPs for this kind of thing while that do not cause problem).