Hello, first of all I am a newbie when it comes to plugin programming.
Let me tell you my problem. I created a map with a blank area, a custom prefab in the middle aprox in (-38.687,-249.985, 222.634) not in (0,0,0) , and a spawn point. The custom prefab is: Brownstone Building (free)


After starting the server and the game, the player spawns at the point in front of the buildings. So far, so good.
Frist i try to list all entities in the server like this:
Let me tell you my problem. I created a map with a blank area, a custom prefab in the middle aprox in (-38.687,-249.985, 222.634) not in (0,0,0) , and a spawn point. The custom prefab is: Brownstone Building (free)

After starting the server and the game, the player spawns at the point in front of the buildings. So far, so good.
Frist i try to list all entities in the server like this:
[ChatCommand("findpos")]
void findpos(){
Puts($"Entity List");
foreach (var entity in BaseNetworkable.serverEntities)
{
if (entity == null || entity.PrefabName == null) continue;
if (entity.GetType().FullName == "MetalDetectorSource") continue;//a lot of this.
Puts($"Entity: {entity.PrefabName} ({entity.GetType().FullName}) : {entity.transform.position}");
}
Puts($"Entity List End");
Puts($"");
Puts($"");
Puts($"Entity List2");
foreach (var entity in BaseNetworkable.serverEntities)
{
if (entity == null || entity.PrefabName == null) continue;
if (!entity.PrefabName.ToLower().Contains("brownstone")) continue;
if (entity.GetType().FullName == "MetalDetectorSource") continue;//a lot of this.
Puts($"Entity: {entity.PrefabName} ({entity.GetType().FullName}) : {entity.transform.position}");
}
Puts($"Entity List2 End");
Puts($"");
Puts($"");
Puts($"Obj List");
var allObjects = UnityEngine.Object.FindObjectsOfType<UnityEngine.Object>();
foreach (var obj in allObjects)
{
if (!obj.name.ToLower().Contains("brownstone")) continue;
var position = (obj as UnityEngine.Component)?.transform?.position;
Puts($"Obj: {obj.name} ({obj.GetType().FullName}) : {position}");
}
Puts($"Obj List End");
Puts($"");
Puts($"");
Puts($"Obj List2");
var objetosFiltrados = Resources.FindObjectsOfTypeAll<GameObject>()
.Where(go => go.name.ToLower().Contains("brownstone"));
foreach (var obj in objetosFiltrados)
{
Puts($"Entity: {obj.name} ({obj.GetType().FullName}) : {obj.transform.position}");
}
Puts($"Obj List2 End");
Puts($"");
Puts($"");
}
[PTest] Entity List
[PTest] Entity: assets/content/vehicles/horse/ridablehorse2.prefab (RidableHorse2) : (251.30, -249.98, -260.83)
[PTest] Entity: assets/prefabs/vehicle/seats/horsesaddle.prefab (HorseSaddle) : (251.04, -248.97, -260.59)
[PTest] Entity: assets/prefabs/vehicle/seats/horsesaddle.prefab (HorseSaddle) : (250.97, -248.97, -260.53)
[PTest] Entity: assets/prefabs/vehicle/seats/horsesaddlerear.prefab (HorseSaddle) : (251.26, -248.97, -260.80)
[PTest] Entity: assets/content/vehicles/horse/ridablehorse2.prefab (RidableHorse2) : (257.51, -250.25, 18.18)
[PTest] Entity: assets/prefabs/vehicle/seats/horsesaddle.prefab (HorseSaddle) : (257.38, -249.23, 18.51)
[PTest] Entity: assets/prefabs/vehicle/seats/horsesaddle.prefab (HorseSaddle) : (257.34, -249.23, 18.60)
[PTest] Entity: assets/prefabs/vehicle/seats/horsesaddlerear.prefab (HorseSaddle) : (257.49, -249.23, 18.23)
[PTest] Entity: assets/bundled/prefabs/system/net_env.prefab (EnvSync) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/system/server/community.prefab (CommunityEntity) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/system/server/resourcedepositmanager.prefab (ResourceDepositManager) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/system/server/relationship_manager.prefab (RelationshipManager) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/system/tree_manager.prefab (TreeManager) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/system/net_global.prefab (GlobalNetworkHandler) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/system/copy_paste.prefab (CopyPasteEntity) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/prefabs/player/player.prefab (BasePlayer) : (-42.98, -249.98, 220.65)
[PTest] Entity: assets/prefabs/weapons/torch/torch.entity.prefab (TorchWeapon) : (-42.98, -249.98, 220.65)
[PTest] Entity: assets/prefabs/weapons/m92/m92.entity.prefab (BaseProjectile) : (-42.98, -249.98, 220.65)
[PTest] Entity: assets/prefabs/weapon mods/smallscope/smallscope.entity.prefab (ProjectileWeaponMod) : (-43.20, -250.00, 220.47)
[PTest] Entity: assets/prefabs/weapons/m39 emr/m39.entity.prefab (BaseProjectile) : (-42.98, -249.98, 220.65)
[PTest] Entity: assets/bundled/prefabs/radtown/crate_elite.prefab (LootContainer) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/prefabs/weapons/high caliber revolver/hc_revolver.entity.prefab (BaseProjectile) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/radtown/crate_elite.prefab (LootContainer) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/radtown/crate_elite.prefab (LootContainer) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/prefabs/tools/deploy (obsolete)/generic_deploy.prefab (Deployer) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/prefabs/weapons/m4 shotgun/m4_shotgun.entity.prefab (BaseProjectile) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/radtown/crate_elite.prefab (LootContainer) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/prefabs/weapon mods/muzzleboost/muzzleboost.entity.prefab (ProjectileWeaponMod) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/radtown/crate_elite.prefab (LootContainer) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/prefabs/weapons/flashbang/grenade.flashbang.entity.prefab (GrenadeWeapon) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/radtown/crate_elite.prefab (LootContainer) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/prefabs/weapons/molotov cocktail/grenade.molotov.entity.prefab (MolotovCocktail) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/prefabs/food/small water bottle/smallwaterbottle.entity.prefab (BaseLiquidVessel) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/prefabs/weapons/crossbow/crossbow.entity.prefab (CrossbowWeapon) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/radtown/foodbox.prefab (LootContainer) : (-33.86, -247.57, 217.48)
[PTest] Entity: assets/prefabs/food/small water bottle/smallwaterbottle.entity.prefab (BaseLiquidVessel) : (0.00, 0.00, 0.00)
[PTest] Entity: assets/bundled/prefabs/radtown/crate_tools.prefab (LootContainer) : (-32.45, -248.48, 207.66)
[PTest] Entity: assets/prefabs/weapons/crossbow/crossbow.entity.prefab (CrossbowWeapon) : (0.00, 0.00, 0.00)
[PTest] Entity List End
[PTest]
[PTest]
[PTest] Entity List2
[PTest] Entity List2 End
[PTest]
[PTest]
[PTest] Obj List
[PTest] Obj: :\Brownstone Bulding 1 Furnished\Brownstone Bulding 1 Furnished:2: (UnityEngine.Transform) : (0.00, 0.00, 0.00)
[PTest] Obj: :\Brownstone Bulding 1 Furnished\Brownstone Bulding 1 Furnished:2: (UnityEngine.GameObject) :
[PTest] Obj: :\Brownstone Bulding 7 empty\Brownstone Bulding 7 empty:1: (UnityEngine.Transform) : (0.00, 0.00, 0.00)
[PTest] Obj: :\Brownstone Bulding 7 empty\Brownstone Bulding 7 empty:1: (UnityEngine.GameObject) :
[PTest] Obj List End
[PTest]
[PTest]
[PTest] Obj List2
[PTest] Entity: :\Brownstone Bulding 1 Furnished\Brownstone Bulding 1 Furnished:2: (UnityEngine.GameObject) : (0.00, 0.00, 0.00)
[PTest] Entity: :\Brownstone Bulding 7 empty\Brownstone Bulding 7 empty:1: (UnityEngine.GameObject) : (0.00, 0.00, 0.00)
[PTest] Obj List2 End
[PTest]
[PTest]
Note that no "building" appears in the server entity list.
try to filter.
Then I looked in another list, and they appeared, but in (0,0,0)
and another list.. and same (0,0,0)
Can you help me?
try to filter.
Then I looked in another list, and they appeared, but in (0,0,0)
and another list.. and same (0,0,0)
Can you help me?