#Player not spawning if AI does and AI doesn't if Player is.

40 messages · Page 1 of 1 (latest)

lyric plinth
#

That should work fine unless you've done something odd with Network Identity settings or haven't added the unitSpawnerPrefab to spawnable prefabs list

#

You'd get warnings or errors on one side or the other for spawn failure typically.

lament ginkgo
#

It's an RTS game. I've got a main player prefab that controls the units. I need to spawn it twice, once with autospawn and a second time with the line of code above for it to be spawned on both the client and the host's side. The problem is that unless I'm "spawning" it twice, the client will be spawned or instantiated but his hero unit won't be spawned. And if I remove it, from the inspector, the player will be sapwned but his units won't, and the ai will. The Ai needs it not to be instantiated twice. And I got not relevant errors in the inspector. When I get home, I'll make a video and show pics of the inspector. Thank you.

lament ginkgo
#

I need both the enemy A.I. heroes to spawn and the main player prefab as well. I'll record a video with the build and post it here in a moment:

#

This is the steam demo version with two players. A host and a client. This version has the "MainPlayer" prefab as the Player Prefab and the unit spawner prefab in the network manager. Unless I assign the "MainPlayer" prefab in both fields in the inspector, the client won't be able to spawn units, bu the ai will spawn:

#

I'll make a second build without the "MainPlayer" prefab assigned a second time and show the game from the client's side.

lyric plinth
#

Seems odd that input controls work in offline...no idea what you're controlling. The errors from steam failures may or may not be interfering. Are we to assume that whatever you put in the Unit Spawner Prefabs list is getting properly registered, or is that prefab (other than what's in Player Prefab) also in the Registered Spawnable Prefabs list below that?

lament ginkgo
#

With the override.

#

The steam failures only happen in the editor, but work as intended on the steam demo.

#

I'm also using dissonance. The voice chat works in both cases. The "MainPlayer" prefab spawns. The "Hero" unit isn't spawning for the "AI", if I make it spawn for the client, if that makes sense.

lyric plinth
#

put the whole of your custom network manager in https://pastie.io/ so I can see what you're doing

lament ginkgo
#

It's a mess, I know.

lyric plinth
#

how is the hero ending up in DDOL?

lament ginkgo
#

I added a Don't destroy game object script to the hero, but that doesn't prevent it from....hmmm.

#

Oh, wait.

#

Ye.

#

Ok, so the hero got instantiated for a moment, then got destroyed on the client's side. So I had to ensure it wouldn't.

lyric plinth
#

that's not how you ensure it doesn't - find what's killing it instead

#

and don't put it in DDOL in Awake in any case

lament ginkgo
#

Ok, removed the DDOL from the hero.

lyric plinth
#

I can't tell from the code if URTS_UNET is valid or not, so I don't know what code is running

lament ginkgo
#

It's a symbol. Everything under if works.

lyric plinth
#

I know what it is, but can't tell if it's a valid symbol in your project 🙂

lament ginkgo
#

Oh, yeah, it is.

#

I mean, it works.

#

Ok, the DDOL is no longer necessary. I don't know why but the hero unit isn't being destroyed any longer.

#

No, for the player.

#

The ai is still not spawning.

lament ginkgo
lyric plinth
lament ginkgo
#

Hero in the Unit Spawner Prefabs list and MainPlayer in Player Prefab? Yes and yes. Will do and return.

#

Will add debug logs.

#

But this isn't the issue either, the heroes spawn once I remove the mainplayer prefab from the "OnServerAddPlayer" override. But if I do that, it's back to square one, can't spawn units.

lyric plinth
#

well first disable that Animator to get rid of that log spam

#

or enable Collapse

#

so you have some sanity to work with

lament ginkgo
#

All right. Did that. Collapsed. Hmm.

lyric plinth
#

and disable the call to RTSToolkit.RTSMultiplayer:Cmd_AddNation in RTSToolkit.Diplomacy:AddNewNation until you can fix it - you can't pass prefabs through Cmd's