Forum rules - please read before posting.

Player disappears from scene when prefab is changed

edited February 2016 in Engine development
Heyo, just wanted to follow up on an observation from when 1.50 came out, namely that the player isn't loaded into the scene when you press Play after changing a setting on the player prefab in the resources folder.

I first saw it on 1.50g when updating an existing project, and thought it may have something to do with not importing the preference files like Tags and Input, but I couldn't figure it out so I accepted it.
But today I started a new project in Unity 5.3.2f1 using AC 1.50i, set up the player using the character wizard and a quick room setup to test, and the same thing happened.

No error message, nothing really 'breaks', just the player doesn't get added to the hierarchy on Play. Re-importing the GameEngine prefab always fixes it. It doesn't happen when I change anything about a child object of the player prefab, but any change to a component on the root gameobject results in this bug.

So, not really a showstopper, just an extra 5 seconds of clicking every once in a while, but I'm curious what's causing this. Maybe its just one of those obscure quirks about 5.3.

Comments

  • Could well be a 5.3 quirk - it's proven to be full of them.  It's good of you to be OK with it, but that's actually a big problem.  If you can answer some questions, it'll go a long way toward me being able to fix it:
    • Is there any noticeable difference between the scene-based GameEngine before and after you re-import it?  (Take a screenshot and compare)
    • Is the Player still tagged as such after changing a setting, and is it still assigned in the Settings Manager?
    • Is there anything else in the scene tagged as Player in the scene once the game starts with no player character present?
    • Any warnings or errors in the Console?
  • Ok wow, this is going to sound really fruity, but I found the problem...

    When I went to take a screenshot of the GameEngine prefab I had to close some UI panels like the console etc so I could capture the whole inspector at once. And all of a sudden I couldn't reproduce the bug. I felt like I had egg on my face, but then I thought "wait, could it have something to do with the UI panels??" So I started testing that, and, well, brace yourself:

    You know that little preview window at the bottom of the inspector, that shows the prefab/sprite you currently have selected? If I CLOSE that (so drag its top edge down all the way to collapse it), the bug is gone.

    I know right.

    Now I can edit whatever I like on the player prefab and it always shows up. But the minute I pull open that preview window again and press play: player prefab gone. It's worth mentioning that if I at that point close the preview window again without reimporting the GameEngine prefab, the player is still missing when I press play. But after a reimport, with the preview window closed, I can make any change I like and everything is fine.

    I could reliably reproduce this in both projects I mentioned, so yeah... 5.3 I guess?

    To still answer your questions:
    - no difference in GameEngine prefab pre- and post-reimport
    - player is still tagged and selected in the settings manager
    - no other objects tagged as player in the scene
    - no warnings or errors (I have full console logging on in the AC settings)
  • Oh Unity..

    Yes, it is a bug with 5.3.  Seems that when you edit the Player, it's created in the scene (but made invisible?!?) so that when the scene begins AC mistakenly thinks the Player is loaded.  Should be fixable.
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.