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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Spawning an actor in C++ on a client causes crash

I'm trying to spawn a local actor on the client that doesn't replicate. I'm using GetWorld()->SpawnActor, but it crashes in PostSpawnInitialize at check(Role == ROLE_Authority) with this error: Assertion failed: Role == ROLE_Authority.

Product Version: UE 4.17
Tags:
more ▼

asked Apr 09 '18 at 03:53 PM in C++ Programming

avatar image

moussamo
18 1 3 8

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

1 answer: sort voted first

Looking into the code within PostSpawnInitialize it appears that the check is making sure that the local machine has the proper flags set to have authority over the spawned actor.

If you're spawning an actor locally on a machine then you need to set its Role to ROLE_Authority to signify that it can be modified by the local machine.

This variable is by default set to ROLE_Authority, but its possible that the spawn parameters could be changing this.

https://docs.unrealengine.com/en-us/Gameplay/Networking/Actors/Roles

more ▼

answered Apr 09 '18 at 04:23 PM

avatar image

Velrin
375 2 8 13

avatar image moussamo Apr 09 '18 at 04:30 PM

I manually set the role to ROLE_Authority and it works now. 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