Announcement

Collapse
No announcement yet.

How can I use generic pointers in UE4 effectively?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How can I use generic pointers in UE4 effectively?

    Hi, I am implementing an AI communication system following Mat Buckland's book "Programming Game AI by Example".

    Each delegate is fired with a struct FTelegram as parameter that contains all useful information. However, I might need, depending on the situation, to send extra information. In the book, the author solves the problem by adding a generic pointer as argument. That way, I can pass an argument of any type onto that pointer. The advantage this method has is that all communication can be handled using this single struct instead of templating it or otherwise making a different struct for each kind of message.

    I have tried implementing this is UE4, but it doesn't seem to like the void* type at all, which I assume is because of safety concerns. I know that one solution would be to overload the constructor, but this could get messy pretty quickly if each message needs a different type of argument.
    So, is there any way to have a generic pointer in UE4?

    #2
    One thing that concerns me about this method is that you still need to parse this data.

    What sort of "extra data" are you referring to?

    Comment

    Working...
    X