Great to hear from you all!
Wherever you currently have
GENERATED_UCLASS_BODY()
you will want to replace it with
GENERATED_BODY()
So if you have a pure C++ class then no change is required!
Great to hear from you all!
Wherever you currently have
GENERATED_UCLASS_BODY()
you will want to replace it with
GENERATED_BODY()
So if you have a pure C++ class then no change is required!
RHI Feature Level
GetMaxRHIFeatureLevel( )
is now
GMaxRHIFeatureLevel
Honestly, this should be an official page. Dear Epic, please hire already. This board is going no where without him.
Thanks a ton for all your works man, following your guide step by step atm. Will report if I found any other error.
edit: Never mind, I forgot to update my shortcuts and open the project with the old 4.5 exe. Everything seems to work nicely now.
Moved my question to the answerhub: Bad name index (unknown exception) - Programming & Scripting - Epic Developer Community Forums
If you were using slate at all in your previous project, expect a lot of errors now.
Youâll need to change:
#include "Slate.h"
to
#include "SlateBasics.h"
Youâll then get a whole bunch of other errors about how some classes arenât being used properly. In the end i just removed slate entirely and iâm rebuilding my UI from UMG.
Anyone having problems with TMap? My project worked fine in the previous version but in 4.6 it crashes inexplicablyâŚ
Any assistance greatly appreciated.
Consider this post a âI think TMap has changedâ
I replied to your answer hub
Youâre welcome !
BlueprintImplementable Const Reference
In 4.6 I have to change this
virtual void BP_Event_SolusFootStepOccurred(FVector Location,TEnumAsByte<EPhysicalSurface> SurfaceType);
to this
virtual void BP_Event_SolusFootStepOccurred(FVector Location,**const **TEnumAsByte<EPhysicalSurface>**&** SurfaceType);
or it will not compile
I seem to recall a time when I could pass TEnumAsByte by value to a BP implementable event, but not any more.
It gives a very vague compile error now, saying the function âwas not foundâ
So if you have any issues with this, try using const reference!
Er, or just pass the enum directly by value:
virtual void BP_Event_SolusFootStepOccurred(FVector Location, EPhysicalSurface SurfaceType);
TEnumAsByte is a storage construct. Its main use is to restrict size of an enum to a single byte, making the managed code able to predict the size of a stored enum as it otherwise varies by compiler.
You also get type safety as an added bonus, but if you care for that you really should be using either the namespace enum idiom or an enum class.
Yup that does work too!
For consistency with the code base I tend to use TEnumAsByte since it is required for UPROPERTY()
it is not required anymore if you use the new recommended way of declaring enums, which is the c++11 good style.
ie use enum class
Did the upgrade from 4.5.1 to 4.6 in the office today. This guide was handy, thanks!
oooooh thanks for that info!
I updated my Enum wiki accordingly.
EDIT: oh wooow, Iâm loving the new C++11 enum, so much easier to work with
[QUOTE=ambershee;191257]
Did the upgrade from 4.5.1 to 4.6 in the office today. This guide was handy, thanks!
[/QUOTE]
Great to hear from you Ambershee!
:)
Hi all, thank you **** for your efforts, very useful thread !
I too have problems with updating my project to 4.6,
I managed to fix everything else pretty fast, except that I canât seem to spawn a blueprint.
I asked a question on answer hub last week:
I spent some more time on that and made several tests including struct FConstructorStatics way,
no luck so far, even if it compiled it didnât work in the game.
Anyway I feel Iâm getting close, will try to figure it out soon as Iâll have time.
Jurij
Talking about the new enum style.
How do you compare or use enum (like for a array index) without casting? It was transparent in the old way, but not with the new way.
ex: MyArray[MyEnumValue], now you have to do: MyArray(int32)MyEnumValue].
you canât do that also : GetDisplayNameText(EnumValue). you must cast.
More how do you get the enum from a number?
Did I miss something?
Thanks,
Thanks,
It was transparent in the old way
[/QUOTE]
Nor should it ever have been. C style enums are not type safe, and implicit conversions thereof have been a recurrent source of errors. People have come up with workarounds like namespace enums to try and guarantee some sort of type safety, but itâs still imperfect because of those implicit conversions.
Just static_cast to/from enum class, it spells out what you mean to do and helps make sure youâre not implicitly casting the wrong thing by accident.
I replied to your Answerhub
now you have to do: MyArray(int32)MyEnumValue].
you canât do that also : GetDisplayNameText(EnumValue). you must cast.
More how do you get the enum from a number?
[/QUOTE]
If you are going to do that you should definitely use
MyArray**uint8**(MyEnumValue)]
Because the enum is really a byte as you can see :
UENUM(BlueprintType) //"BlueprintType" to expose to Blueprints
enum class EVictoryEnum : **uint8**
{
VE_Dance UMETA(DisplayName="Dance"),
VE_Rain UMETA(DisplayName="Rain"),
VE_Song UMETA(DisplayName="Song")
};
It is of course not entirely recommended way of doing things, but int32 is simply out of the question under any circumstances
G**etting Value**
You mentioned wanting to get an exact value of an enum, you can get exact value even like this if you want!
```
SCREENMSG2("bytecast", **uint8**(EVictoryKeyModifiers::Shift));
```
Again, I am not suggesting this is an ideal way to do things, I'm just answering the question :)
Enjoy!