Forum rules - please read before posting.

Player prefab not added to scene very rarely

Ok, this is a strange one, so let's start out simple with versions:

Unity 2018.2.0f2
AC 1.64.5

Put simply, in one particular scene, very very rarely, and in completely different circumstances, the player prefab does not seem to be added to the scene, or is perhaps in the scene but not put at the player start.

This happened 3 times during 2 months of testing, and 1 time was to me, so I know my testers aren't lying, as if they would anyway. And then happened again today to a customer after release. I can't fathom what's going on here, so I will just tell you the facts as I know them.

1. It only ever happens in one scene, out of 16 scenes in the game.

2. This has only ever happened in a build. It has never happened when running in the editor, and I have played through the game who knows how many countless times in the editor.

3. I cannot reproduce it. No matter what I do, I cannot figure out how to make this happen. My BEST guess is that it has something to do with switching player prefabs? because I do so a couple times in this game, and maybe it usually seems to happen when people enter that scene after the switch? but that is such a shot in the dark, it's honestly barely worth mentioning. It has only ever happened 4 times, so we have very little data.

4. The scene it happens in has only one player start which is set to default.

5. All hotspots still work, even ones with walk tos, but the customer today said the door hotspot didn't work when he clicked it, although in all 3 previous times, clicking the door did exit the scene, and upon re-entering, the bug was gone.

There's pretty much nothing else I can say. I'm clueless. It sometimes happens near the beginning of the game, sometimes in the middle, sometimes near the end, there is no clear pattern of things people have done before this happened... and I can't make it happen to get more data.

Ideas?

Comments

  • Apologies that this was encountered by a customer.

    When a player prefab is spawned in via the Settings Manager, he's independent of the open scene - meaning he should always be present upon a scene change unless he's intentionally removed.

    Given the rare and difficult nature of this issue, however, it may take a while to discover the source - certainly this hasn't been something that has been previously reported.

    We'll first need to learn more about the project and circumstances.
    1. If this is in builds only, what platform are you building to?
    2. You mention that you're relying on multiple player prefabs.  In what capacity?  Do certain scenes involve a "local" player, or are you using the Player: Switch Action to change the active player?
    3. What are the details of the player that should be present in the scene?  Are you switching to this player as a new character when loading the scene, or was he already the player character in the previous scene?  It may be best to see the Actions(s) involved with any player switch/scene change.
    4. Are you relying on additive scenes, or just opening one at a time?
    5. When you talk about the "Door Hotspot", is this a Hotspot in the problematic scene, i.e. an interactive object that is being used despite the absence of the player?
    6. Are you guessing that the player is not present because you cannot see him?  Is there any way to tell if he's just hidden, by e.g. a subtitle menu that's set to appear at his location is to the side of the screen?
    7. If this is occuring in only one scene, then there must be something about that scene - whether the scene itself, or the conditions under which it is opened - that is different from the others.  Is there anything that sticks out?

  • 1. Building to Windows and Linux. 1 of the the times it happened was in the Linux build. The other 3 in the Windows build

    2. I use Player: Switch in a scene to have the character change his clothes. There is also one scene that has a local player, and the two scenes he can exit that one from, both check whether he has changed his clothes, and use Player: Switch to get the right player prefab. None of these scenes are the one question or even a scene from which one can enter the scene in question. You have to go through at least one more scene after any Player: Switch to get to the problematic one.

    3. He was always the same player character in the previous scene. No Player: Switch happens in this scene or the previous one.

    4. Opening one at a time

    5. Yes, the door hotspot is a hotspot in that scene. Hotspots are still interactable (although the customer claimed the door wasn't but I don't know what to think about that since it was the other 3 times)

    6. Yes, the player is not visible in the scene. he could be off somewhere else, he's just not in the visible part of the scene. I could do that, but the issue would be finding a way to make the bug happen which I have so far been completely unsuccessful at. It just randomly happens very rarely.

    7. I wish I could. I've searched for things that might be different than other scenes, but nothing strikes me. This is actually a pretty simple scene, one of the most simple in the game. There's not much to it, one player start, 5 hotspots (including the door), Onstart and Onload cutscenes which don't do anything strange. Onload just checks a variable and adds a fire to a fireplace if it has been lit, and also moves an NPC off camera and disables his hotspot based on a variable set in another scene. All of those things work fine when the bug happens. There is just no player.
  • What are the build index numbers of the problematic scene and the scene with the local player?

    It is strongly advised not to rely on local players if you are also using multiple player prefabs - see the Manual's "Player switching" chapter.  You should also be getting warning messages in the Console when in the scene with the local player.

    Problems related to player data can occur otherwise, so that may well be the issue. Without being able to reliably recreate it, however, it'll be difficult to determine.

    Such behaviour is rarely random, though it may seem so - unless you've found that performing exactly the same steps gives different results.

    Unity does actually keep log files when playing built games: see Log Files.  If you can get a log file recorded when the issue occured, that'll help pin things down.  Even if the issue is ultimately not directly related to having a local player, I recommend you move entirely to player-switching through prefabs.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.