Forum rules - please read before posting.

Simple Camera Close Up and Hotspots

edited May 2024 in Technical Q&A

Hi, I followed the FirstPerson tutorial and added a close-up camera to my scene, but my hotspots are not interactable when this close-up camera kicks in. Do I need to do something extra? I checked the manual but couldn't find anything.

Comments

  • So long as you're in "gameplay" mode at the time, that should be fine. You'll need to use Engine: Manage systems to set your Movement method to None, and unlock the cursor to be able to move it, but the tutorial should have covered that.

    Are these all the case? You can check the game's current state by enabling the AC Status box at the bottom of the Settings Manager.

  • edited May 2024

    Yes, the debug window indicates that I'm in the normal current state. The issue arises when the Unlock menu activates to display the exit button. In your example, you're utilizing the AC prefab, but in my case, I'm using Unity UI. There seems to be something causing the problem, potentially related to raycasting.

    I send you a few screenshots.



  • It may be the size of the "CloseUp Canvas".

    The Menu's RectTransform boundary field is used to describe what portion of the screen the Menu takes up. Clicks over it will be "consumed" by the Menu - so it should generally be assigned a RectTransform that spans the clickable area.

    This is usually the Canvas's immediate child - as you've done here - but it's not a requirement, it can be another object.

  • edited May 2024

    That was the problem. I reduced the size of the canvas to cover only the button and the hotspots are working again. Thanks!

    By the way, I remember your suggestion in the tutorial of adding the action list to switch things back to start the game in first-person mode, when working with close-up cameras. However, even though the action list is working, I have to press play twice to activate the changes in player movement. It seems like the first time doesn't work, and I have to replay for the player movement to be in first-person mode again. (Not sure if I explained myself properly)

  • Changing the Movement method affects the Settings Manager itself, which is an asset file. Such changes are still kept when exiting Play mode, so you'll need to make sure that your game begins with the right values.

    To do this, you run an Action to set it to First Person, and assign its ActionList asset as the ActionList on start game field at the top of the Settings Manager. This'll cause it to be reset correctly before anything else gets run.

  • edited May 2024

    Yes, that's exactly what I did. And the reset only happens on the second try.
    Here is the timeline of events:
    1. I lunch a closeup camera. I don't exit the camera and I stop the game execution.
    2. I play again to run the game. Camera is locked in the origin coordinates I think. No control. I got a info log in the console:

    >! Starting a non-First Person game with a locked cursor - is this correct?
    
     -> AC debug logger
    UnityEngine.Debug:Log (object,UnityEngine.Object)
    AC.ACDebug:Log (object,UnityEngine.Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:23)
    AC.PlayerInput:InitialiseCursorLock (AC.MovementMethod) (at Assets/AdventureCreator/Scripts/Controls/PlayerInput.cs:959)
    AC.ActionSystemLock:Run () (at Assets/AdventureCreator/Scripts/Actions/ActionSystemLock.cs:51)
    AC.ActionList/<RunAction>d__46:MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:466)
    UnityEngine.MonoBehaviour:StartCoroutine (System.Collections.IEnumerator)
    AC.ActionList:ProcessAction (int) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:408)
    AC.ActionList:ProcessActionEnd (AC.ActionEnd,int,bool) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:613)
    AC.ActionList:EndAction (AC.Action) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:572)
    AC.ActionList/<RunAction>d__46:MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:536)
    UnityEngine.MonoBehaviour:StartCoroutine (System.Collections.IEnumerator)
    AC.ActionList:ProcessAction (int) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:408)
    AC.RuntimeActionList:BeginActionList (int,bool) (at Assets/AdventureCreator/Scripts/ActionList/RuntimeActionList.cs:181)
    AC.ActionList:Interact (int,bool) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:279)
    AC.RuntimeActionList:DownloadActions (AC.ActionListAsset,AC.Conversation,int,bool,bool,bool) (at Assets/AdventureCreator/Scripts/ActionList/RuntimeActionList.cs:136)
    AC.AdvGame:RunActionListAsset (AC.ActionListAsset,AC.Conversation,int,bool,bool) (at Assets/AdventureCreator/Scripts/Static/AdvGame.cs:242)
    AC.AdvGame:RunActionListAsset (AC.ActionListAsset,int,int) (at Assets/AdventureCreator/Scripts/Static/AdvGame.cs:163)
    AC.StateHandler:PlayGlobalOnStart () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:617)
    AC.SceneSettings:PlayStartCutscene () (at Assets/AdventureCreator/Scripts/Game engine/SceneSettings.cs:336)
    AC.SceneSettings:OnStart () (at Assets/AdventureCreator/Scripts/Game engine/SceneSettings.cs:110)
    AC.SaveSystem/<InitAfterLoadCo>d__51:MoveNext () (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:830)
    UnityEngine.MonoBehaviour:StartCoroutine (System.Collections.IEnumerator)
    AC.SaveSystem:InitAfterLoad (int) (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:738)
    AC.MultiSceneChecker:RunStartProcess () (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:122)
    AC.MultiSceneChecker:Start () (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:54)
    
    1. I stop the game.
    2. I run the game again. Now the game starts with the reseted actionList.

    I added a log to see if the start actionList runs and it does. Only the second time I launch the game the game starts as expected.
    AC version: 1.80.4
    Unity: 2022.3.25f1

  • The log in the Console can likely be ignored - what we need to instead focus on is the effect it has in-game.

    When you run for the first time, and things don't work as expected, pause the game and check the "Movement method" in the Settings Manager, and the MainCamera's active camera as listed in its Inspector. Are these both set to first-person, and what is the exact behaviour when attempting to move around the scene?

  • So when I play again the game after stopping it during the closeup camera, the debug window says:

    • Current Game State: Normal.
    • Current Player: FirstPersonPlayer

    The "Movement Method" says: First Person.

    When I try to move in the scene, nothing happens. Everything is locked and the camera is not even where is supposed to be. Is in a weird place in the scene.

  • Does the Status box list the "Current camera"? The MainCamera's Inspector should also list the camera its currently attached to.

    Does your scene have an opening cutscene? If not, create an OnStart cutscene, and have it run a simple Engine: Wait Action of 1 second - does the camera correct itself afterwards?

  • Does the Status box list the "Current camera"? The MainCamera's Inspector should also list the camera its currently attached to.

    As a matter of fact no. It doesn't show up. The only information displayed is Current Game State and Current Player.

    I tried your suggestion (I didn't have any actionlist OnStart), but it didn't work. I saw the action running in the status box for that second, but then it went back to show only the information I mentioned above.

  • edited May 2024

    Very odd. I can't reproduce such behaviour at all.

    While the ActionList runs, does the Status box list the "Current game state" as "Cutscene"? Inside it, try running one more Engine: Manage systems Action to update the Movement method to First Person.

    Probably best to do some light debugging in the scripts to see what's going on.

    If you open up AC's MainCamera.cs script, look for the OnEnterGameState function around line 2052.

    At the top of it (just above the if (gameState == GameState.Normal || line), copy/paste the following:

    if (gameState == GameState.Normal) Debug.Log ("Movement method:" + KickStarter.settingsManager.movementMethod + ", Player: " + KickStarter.player);
    

    Enter Play mode, and then look for Console messages that begin with "Movement method:". Copy/paste them all in full (stacktrace included, as seen when selected in the Console window), and share them here. I'll take a look and see if they can shed any light.

  • edited May 2024

    While the ActionList runs, does the Status box list the "Current game state" as "Cutscene"?

    No. It states "Normal".
    (When I put OnStart actionList I can see during the 1 sec is "Cutscene", but then it goes back to the "Normal" state.)

    I followed your instructions. This is what it came out:

    Movement method:FirstPerson, Player: Active Player Ethan
    UnityEngine.Debug:Log (object)
    AC.MainCamera:OnEnterGameState (AC.GameState) (at Assets/AdventureCreator/Scripts/Camera/MainCamera.cs:2054)
    AC.EventManager:Call_OnChangeGameState (AC.GameState,AC.GameState) (at Assets/AdventureCreator/Scripts/Managers/EventManager.cs:311)
    AC.StateHandler:LateUpdate () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:329)

  • OK. Remove that line now, and go up to the SetFirstPerson function (around line 438).

    Find the code block:
    
    if (firstPersonCamera)
    {
        SetGameCamera (firstPersonCamera);
    }
    

    And add just underneath:

    else ACDebug.LogWarning ("No first person camera found on " + KickStarter.player);
    

    Does a new Warning appear in the Console at the time the previous Log showed?

  • edited May 2024

    There is a warning:

    PlayerStart 'DebugStart' has no Camera On Start
    
     -> AC debug logger
    UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
    AC.ACDebug:LogWarning (object,UnityEngine.Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:39)
    AC.PlayerStart:PlacePlayerAt () (at Assets/AdventureCreator/Scripts/Navigation/PlayerStart.cs:94)
    AC.SceneSettings:AssignPlayerStart () (at Assets/AdventureCreator/Scripts/Game engine/SceneSettings.cs:127)
    AC.SceneSettings:OnStart () (at Assets/AdventureCreator/Scripts/Game engine/SceneSettings.cs:109)
    AC.SaveSystem/<InitAfterLoadCo>d__51:MoveNext () (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:830)
    UnityEngine.MonoBehaviour:StartCoroutine (System.Collections.IEnumerator)
    AC.SaveSystem:InitAfterLoad (int) (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:738)
    AC.MultiSceneChecker:RunStartProcess () (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:122)
    AC.MultiSceneChecker:Start () (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:54)
    

    I checked and is just a normal marker that runs in the Scene Settings->Default Player Start. I don't understand why the warning.

    Beyond that, I don't see anything new.

  • Thanks for the details. We're not getting enough from these though, unfortunately - it's looking like I'll need to take a look inside the project myself to get to the bottom of this.

    Would you be able to PM me a .zip of your project folder? The Library folder can be omitted to help reduce filesize.

  • Bufff... It would pretty big. Look, I appreciate your help but I can live with that. If this become a real problem, I'd do a gym level and I'll try to reproduce it there. :)

  • I wouldn't need the same project - you could create a duplicate and remove unnecessary assets (models, animation, sound, scenes etc). So long as you can run a specific scene, with the game initially set to non-first person, with an "ActionList on start" to make the switch being ignored, that would be enough.

  • Ah, ok. I'll try. My worried is that if I remove elements from the scene, I'll start getting errors.

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.