AI Command Lab // Flight Simulator
305F: The Fleet Spawner
Initial AI Output (Fragile)
// AI-Generated Code: Desync
void CastSpell() {
// Audit Fail: This creates a local object.
// Other players will not see it, but they might take damage?
Instantiate(fireballPrefab, pos, rot);
}
Initial AI Prompt
"You ask the AI: "Spawn a fireball.""
Pilot Comm Link
Mission Objective: A skilled Navigator directs the AI to use Network Spawn.
Optimized Protocol
// Corrected: Fleet Registration
[ServerRpc]
void SpawnFireballServerRpc() {
GameObject go = Instantiate(prefab, pos, rot);
go.GetComponent<NetworkObject>().Spawn();
}