- 0
Total number of downloads.
Total customers served.
Total number of files sold.
Total payments processed.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
Question
MooDDang
Hello developers, I am working on a plugin to spawn a "Giant Drone" boss.
My Approach: To increase the size of the drone, I spawned a SphereEntity, set its scale to 25.0, and then parented a Drone entity to it.
The Problem:
Sync Issue: Players who are near the spawn point see the giant drone correctly. However, players who come from far away (entering the network group later) see the drone at its default scale (1.0x) instead of 25.0x.
Failed Attempt (Important): I tried to force a sync by calling SendNetworkUpdateImmediate() on both the parent (Sphere) and the child (Drone) when a player enters the zone. However, this never worked. The client still renders the drone at the default scale (1x) even after receiving the update packet.
Performance Issue: I also tried calling SendNetworkUpdateImmediate() in a loop (e.g., every 0.1s), but it only caused severe server lag/freezing and still did not fix the visual sync issue for new players.
My Question: It seems SendNetworkUpdateImmediate() does not properly force the client to update the inherited Scale from a parent entity.
Is there a known workaround to force the client to re-sync the hierarchy/scale correctly when a player enters the network range?
Any advice would be appreciated. Thanks!
The Code Snippet
```
// 1. Create Carrier (Sphere)
string spherePrefab = "assets/prefabs/visualization/sphere.prefab";
SphereEntity sphere = GameManager.server.CreateEntity(spherePrefab, startPos, spawnRot) as SphereEntity;
float scale = 25.0f;
sphere.currentRadius = scale;
sphere.lerpRadius = scale;
sphere.transform.localScale = new Vector3(scale, scale, scale);
sphere.EnableSaving(false);
sphere.EnableGlobalBroadcast(true); // Tried this, but didn't help much
sphere.Spawn();
sphere.SendNetworkUpdateImmediate();
// 2. Create Drone and Parent
string dronePrefab = "assets/prefabs/deployable/drone/drone.deployed.prefab";
BaseEntity drone = GameManager.server.CreateEntity(dronePrefab, Vector3.zero, Quaternion.identity);
// Parent to the scaled sphere to resize the drone
drone.SetParent(sphere);
drone.transform.localPosition = Vector3.zero;
drone.transform.localScale = Vector3.one;
drone.Spawn();
```
Edited by MooDDang2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now