Forum rules - please read before posting.

Player Start not working - Defaults to Main Camera

For some reason, when I test my current scene, despite having a player start in it and having a working player prefab set to it, the game defaults to the main scene camera. I can't move or control the actual player. I've tried resetting the prefab and start assignments in the AC game settings.

The only other info I can give is that this started after I loaded an old project's autosave within this scene. Funnily enough, it teleported me to a camera within the demo basement scene. Now this bug occurs when I try testing my current scene, even after I found and deleted the test save files.

Comments

  • Which versions of Unity and AC?  Is this problem limited to just this scene?

    When you say the PlayerStart does not work, do you mean that the player does not appear at its position when the game begins?  And this is assigned as the "Default PlayerStart" in the Scene Manager?

    The default camera field is actually a part of the PlayerStart prefab, so solving the PlayerStart issue should also solve the camera one.  Do any error messages appear in the Console window?
  • Both the player prefab and the player start are set as their appropriate defaults in the scene and setting managers. The player prefab does appear in the editor when the test is run, but I am not in control of it. Rather I am viewing through the Main Camera with only control of the cursor and UI. No error messages other than the triple "Invalid editor window UnityEditor.FallbackEditorWindow
    UnityEditor.EditorApplicationLayout:FinalizePlaymodeLayout()"
    I am using the latest versions of both AC and Unity.
  • Again, is the problem limited to just this scene?  If so, replacing your GameEngine object may solve this.  This will mean recreating your local variables and re-assigning your default scene prefabs, however.

    I can't say why this would happen after loading an auto-save, but hopefully we can find a workaround.
  • Oddly enough, the same problem is occurring in a newly created scene.

    In case I should still replace my GameEngine object, how do I do that?
  • If it's occuring in a new scene, replacing the GameEngine object in your first-reported scene won't be the answer.  I would instead recommend re-importing AC from the Asset Store.
  • edited April 2016
    I'll give it a shot, but the thing that worries me is last time I re-imported AC into a project, it reset all of the settings in the AC game editor. I remember it resetting my menu configurations was a significant change.

    EDIT: Re-imported fixed the problem, but it still reset all of my settings. I still have no idea what caused that problem in the first place.
  • By settings, you mean the Managers?  Are you editing any of AC's original Manager asset files?  You should only ever amend your own, which the New Game Wizard will generate for you.

    Your Managers may reset back to the Demo_ counterparts after an update, but they can be easily set back to your own game's by double-clicking their associaciated ManagerPackage asset file to re-assign them.  Again, this is generated by the New Game Wizard - see the Manual's section 1.6 for more.
  • Hi, i'm having exactly the same issue. I created the first level and is working. Created second level, did everything like in first one, and is happening exactly this!
    Even creating the other camera and making the default, starting the game it will display the unity default. I tried to delete it, and then the correct camera will be shown in game, but no player will be spawned at playerstart! I'm really confused, everything is set correctly...

  • even music isn't playing like in other level...

  • What do you mean by "displaying the unity default"? Any screenshots you can share that thow the scene, your Managers, and exactly what happens, will help give context to the situation.

    Are any relevant messages appearing in the Console?

    Just in case: be sure to use the same set of Managers for all your game's scenes. This is where "global" data such as your Player prefab, and music tracks, are stored. You don't need to use the New Game Wizard for each new scene you create.

  • I mean the "main camera" when you start the scene. I do not use the wizard for any new scene of course. I tried to create the scene again from start, now playerstart is working, camera view is correct in preview mode BUT when i styart game, Main camera is used in place of AC one

  • edited October 2023

    Do not know if is the reason, only thing changes is the "fang autotile" addon...

  • Main camera is used in place of AC one

    Is this to say there is a separate MainCamera object to the AC MainCamera?

    Your scene's MainCamera - i.e. the Camera in your scene tagged as "MainCamera" - should have AC's MainCamera component. The Scene Manager should add this automatically.

    If you have two MainCameras, you'll need to merge them. Again, if you can share screenshots showing how your scene is set up - Hierarchy and Inspectors of the Camera(s) included - will help clarify what's going on.

    Do not know if is the reason, only thing changes is the "fang autotile" addon...

    I'm not familiar with that asset - we can't rule out it having an effect.

    Does this issue occur if you don't add this asset to the scene? Try with a fresh AC scene, adding a simple sprite to the scene, without the use of Fang AutoTile.

  • i know that Ac game camera is a reference for main camera and yes, main camera has Ac script on it. Actually the only issue i have is that if i change background color of Game Camera, when i press play i see the background of main camera and not the other one. Not a great issue, but in the first scene i set up is different and i fear that can be a problem someday. I will post some picture asap

  • if i change background color of Game Camera, when i press play i see the background of main camera

    This is by design. As the GameCamera is a reference only for the MainCamera, the MainCamera is what will perform the rendering. Its render settings - including the background colour - will be used instead of the GameCamera's.

    If you want the GameCamera's background colour to be "transferred" to the MainCamera, you can do that through a simple script attached to the MainCamera:

    using UnityEngine;
    using AC;
    
    public class CopyCameraColour : MonoBehaviour
    {
    
        void Update ()
        {
            if (KickStarter.mainCamera.attachedCamera)
            {
                KickStarter.mainCamera.Camera.backgroundColor = KickStarter.mainCamera.attachedCamera.Camera.backgroundColor;
                KickStarter.mainCamera.Camera.clearFlags = KickStarter.mainCamera.attachedCamera.Camera.clearFlags;
            }
        }
    
    }
    
  • Sorry, i'm here again but i'm still really confused about difference between Unity main camera and GameCamera object. Every time i set up a new scene i get crazy trying to make things work.
    This time (creating a "map scene") i added a Gamecamera 2d object to the scene, but it wasn't working. I noticed it wasn't flagged as active (do not know why) so once i did it, the camera view was correct both in edit mode and once game started. So i added OnStart cutscene to remove inventory from view and everything was fine. Sent laptop in standby and once resumed, started again the game to discover that:
    Camera view was again the Main Camera and not the Ac GameCamera
    Inventory was again there (???) even if locked off in cutscene.

    During gameplay shouldn't i see the view of Gamecamera object? And also, how is possible that things change without anything being modified in the meantime?

  • What are your AC/Unity versions?

    The description isn't enough to understand the underyling issue. Can you take screenshots / record a video showing everything?

  • Ac camera missed Constant id number component. And i tagged it as "main camera", this because i needed to have the Outline visible in edit mode, just in order to places tiles correctly.
    That caused the issue :(
    As i put back the Main Camera tag to the unity camera, everything worked again.

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.