Announcement

Collapse
No announcement yet.

[SOLVED] UPROPERTY(Replicated) keeps throwing obscure error.

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

    [SOLVED] UPROPERTY(Replicated) keeps throwing obscure error.

    I have a replicated actor ABoardGenerator, and within it there are two arrays of actor pointers (the actor derived classes are AGround and AUnit)
    Code:
    UPROPERTY(Replicated)
    AGround** GroundBoard;
    UPROPERTY(Replicated)
    AUnit** UnitBoard;
    I do have ABoardGenerator::GetLifetimeReplicatedProps defined in ABoardGenerator.cpp, along with the DOREPLIFETIME macros and the proper includes. Without UPROPERTY(Replicated) everything works fine, but with it I get this completely undescriptive error:
    Code:
    Error: Missing '*' in Expected a pointer type
    That's it. I saw a mention on the wiki that:
    NOTE: UObject based classes (or derivatives) should be passed by pointer (*) and will correctly // address the version of that object on the receiving client or server (unless that object is not // replicated, in which case the pointer will be NULL).
    But the thing is, they are pointers, it's an array of AGround*/AUnit*.
    Thanks in advance.
    Last edited by goodtrailer; 12-26-2019, 12:21 AM.

    #2
    Lesson of the day: use TArrays. Unreal grooves better with TArray instead of C style arrays. I probably should have realized this sooner, considering TArray comes with UE4.

    Comment


      #3
      You're declaring them as pointers to pointers (double asterix). This is wrong, only regular pointers can be replicated (single asterix)

      That's also not how you declare an Array in C++, both in regular C++ or in UE4 C++. In UE4, you must use TArray<> to replicate an array of objects.

      Comment

      Working...
      X