#Instantiate a predicted prefab client-side, and as a client-only entity

1 messages · Page 1 of 1 (latest)

opaque vector
#

My use case is this:
I have a bunch of synced prefabs shared by client and server. They are supposed to only be instantiated by the server because they are predicted.
However, I want to also instantiate them client-side and non-predicted, such that all the clients can see the prefabs on display. Say, in a grid for example.

If I instantiate them in a ClientSimulation system, I get the error: Entity Unity.Entities.Entity is not a valid ghost ...
I'm thinking it might work if I remove all of the netcode components on instantiation, but I really hope there's a simpler and less time consuming solution.

So, is there?

#

Instantiate a predicted prefab client-side, and as a client-only entity

opaque vector
#

Removing GhostInstance worked. No idea if there will be any side-effects later on, but it's a straightforward enough solution.

pale carbon
#

Prefabs that are meant to only be instantiated on client shouldn't have any ghost components in the first place; they should just be regular prefabs with no GhostAuthoring

opaque vector
#

So will I need to create an identical prefab without any of the ghost components for my client to instantiate them propely?

wicked elbow
#

I'd just setup a prefab with all the components except ghost

#

And then a prefab instance of that query just the ghost component added

#

Seems like it shouldn't be that hard to maintain

opaque vector
# wicked elbow And then a prefab instance of that query just the ghost component added

Do you mean I could add the ghost component to the instantiated instances of a prefab, or bake a separate prefab with the ghosts components added in the baker?

Also, do I only need to add a GhostInstance? What about all the other components?

How would I have control over whether a specific prefab should be static or dynamic, and whether it be interpolated or predicted, etc. I could probably have those variables in the baking MB, but that seems like such an extra step.

wicked elbow
#

I just mean a game object prefab and bake them seperate

proud fulcrum
#

You can use the new "Prefab Variants" feature for this yeah. It allows the "Variant" to automatically get all changes made to the "Root" Prefab.

Select all of your gameplay prefabs, press Create > Prefab Variant, then mass add a GhostAuthoringComponent to all Variants.