x

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"

Server and Client implementations both called

I'm trying to change the color (material) of an actor that I spawn during gameplay. It works when running on a server but not on a client. (The actor is spawned on the client but the material change is only visible when looking at the actor on a server.) To try to understand what is happening I created 3 functions:

changeColor()

UNFUNCTION(Client, Reliable) void clientChangeColor();

UFUNCTION(Server, Reliable, WithValidatin) void serverChangeColor();

My changeColor function calls both clientChangeColor and serverChangeColor. I put a breakpoint at the beginning of clientChangeColor_Implementation and serverChangeColor_Implementation thinking that one or the other will get hit, depending on whether I'm running a client or on a server. But on both client and server both breakpoints get hit every time. How is this possible?

Product Version: UE 4.7
Tags:
more ▼

asked May 27 '15 at 05:01 AM in C++ Programming

avatar image

Ian Proulx
44 7 10 20

avatar image Detech May 27 '15 at 06:52 AM

The actor is spawned on the client but the material change is only visible when looking at the actor on a server.

Are you sure? If you spawn actor on a client - it will be cosmetic and not exist on server.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Since your actor is owned by the client this is the behavior. See: https://docs.unrealengine.com/latest/INT/Gameplay/Networking/Actors/RPCs/index.html

There is a table there. If you invoke a function from the owning client to the server or client it gets executed on client/server.

more ▼

answered May 27 '15 at 06:18 AM

avatar image

cageman
663 30 33 64

avatar image Ian Proulx May 27 '15 at 07:07 AM

Got it. Thank you very much.

(comments are locked)
10|2000 characters needed characters left
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