Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Problems with replicating dynamic material

Edit 3: I am now creating the deck entirely in blueprints. I call a BlueprintImplementableEvent in C++ to create the deck. It goes through a For loop, creating each card. Every time the index changes I set a variable to the new index (the index number controls the scalar parameter to set the texture of the card material). The index is RepNotify so it calls a function to then set the material. Once again, it doesn't work on the client. I'm thinking the problem might be elsewhere.

Edit 2: I managed to get rid of the LogNetPackageMap warnings by creating a blueprint of the card, setting up the dynamic material in the construction script of the card's blueprint, and then spawning the blueprint cards in C++. However, I still can't manage to replicate the material. I tried making a multicast function in blueprints themselves via a BlueprintImplementableEvent that got called first, Repnotify in C++, and Multicast in C++. They always update on the listen server, but never on the client. I still have no idea what's wrong.

Edit 1: I have discovered from this question that my material must not be net addressable because it is created at runtime. I get one of these warnings for each card: LogNetPackageMap:Warning: UPackageMapClient::SupportsObject /Game/UEDPIE_1_level1.level1:PersistentLevel.SCard_145.CardComp1.MaterialInstanceDynamic_415 NOT Supported.Not RF_WasLoaded. NetGUID: <0>

I guess now my question becomes: How do I make my material net addressable? The answer on the other thread was to pass the texture as a parameter via an RPC function. However, the server should be telling the client to update the material, not the other way around. Why would an RPC function work and not a plain old repnotify or a multicast? I am quite confused.

I have a deck of cards where each card has a dynamic material associated with it. The texture of this material changes depending on what card it is, ie. Ace of Spades, 2 of Diamonds, etc. The problem is that the updates to the material are not getting replicated. On the listen server, all the cards look as expected, but the client shows nothing but 2 of Spades, which is the first card in the texture.

I have replicated every relevant variable in the Card class as well as the GameMode class where the deck actually gets created.

My repnotify function looks like this:

  void AMyGameMode::UpdateCardMID() {
       Deck[CardIndex]->TheMaterialMID->SetScalarParameterValue(FName("Card"), MIDvalue);

Deck, CardIndex, TheMaterialMID, and MIDvalue are all replicated. MIDvalue (which tells the material the texture coordinates to use) has UPROPERTY(ReplicateUsing = UpdateCardMID) which I remember to call after MIDvalue changes.

I've also added all these replicated variables to the GetLifetimeReplicatedProps function in their relevant classes.

The repnotify method is what I'm doing currently. I have also tried multicast replication but that didn't work either. I could really use some help if anyone has an idea what the problem is.

Product Version: Not Selected
more ▼

asked Nov 08 '14 at 11:19 PM in C++ Programming

avatar image

534 59 164 124

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I finally figured this out. First, I was trying to setup the repnotify or the multicast in the GameMode instead of the Card object itself, ie. I was trying to change the card's material within the GameMode instead of the Card. I guess if you want to change an object's material you can't do it outside of the object? In any case, I created a variable inside of the Card object that controls the Scalar Parameter of its dynamic material. This variable is RepNotify. I set this variable in the GameMode, but the repnotify function itself resides within the Card.

Another thing I found by looking at the networking Content Examples, specifically the street light, is that neither the StaticMesh, nor the materials are replicated. I was pretty much replicating everything to make this work, but I found that if the material is replicated, then it actually stopped working.

Not sure if it this was a result of quirks in my own set up or not, but it worked for me.

more ▼

answered Nov 17 '14 at 01:57 AM

avatar image

534 59 164 124

avatar image edcolmar Jan 12 '17 at 07:05 PM

Can you please post the final working code?

avatar image NickNasti Dec 07 '18 at 09:48 PM

You're a life-saver. Thanks.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question