I have been having a little problem with the sets in Unreal Engine 4.15.3 (Using blueprints)
I was creating a set of structs for use in some experiments I was doing, when I encountered an odd issue with structs that contain rotators. I found that after adding a rotator to one of my structs all sets that contained that struct broke. I then set out to try to recreate the issue and found the following:
- Sets of rotators don’t seem to work - changing a set type to a rotator clears the set and returns it to a normal rotator variable
- Sets of structs that contain rotators also won’t allow me to make a set of them. Changing the struct to add a rotator to it will then create compile errors on any blueprint that has a set of that struct.
- Structs that contain a different struct that contains a rotator does seem to allow sets? At least I haven’t got it to break with that yet
When changing a set to a struct that contains a rotator, or selecting a rotator directly the following error appears and the variable gets changed to a normal variable instead of a struct.
Error:
container type cleared because ‘RotatorStruc Structure’ does not have a GetHashType
function. Maps and sets require hash
functions to insert and find elements.
My question(s) are the following:
-
Why does it do this? is there
something I dont know about sets that
gives this kind of behaviour. -
Why do rotators that break it? I haven’t tested it with every different variable type so there may be more, I think I got it to break with one of the built in structs as well. Is there anything I should steer clear of using with sets?
-
What is be best way arround this? Nesting the rotators in a separate struct prevented the compile errors but will this create additional issues?
-
Is there any proper documentation on sets (documentation on maps would be nice as well)? I tried searching for something but couldn’t really find anything in the unreal wiki. This behaviour seems a little random and I am concerned that attempting to build my system using sets may run into issues without knowing what is going on. Sets and maps are ideal for what I am building and I am concerned that I will keep running into issues if I can’t check documentation to work out what their behaviour
-
Is this a bug or a feature?
Sets seem to be ideal for what I want especially with the set union feature but I ideally need rotators. Till I get an answer I will be experimenting with workarounds but without any documentation to go off I may be unable to work out a good solution.