Forum rules - please read before posting.

First person problem

13»

Comments

  • Hi Chris, i have a small problem.
    I've created a main menu using this tutorial Creating a Title-screen menu . When i press New Game the game works fine, i have some triggers that i turn them off just to play them one time, i have some objects in the inventory, when the game ends the credits are showed, when the credits ends i made a **Scene:Switch ** back to the main menu in case you want to play it again, but this time when i press again New Game the game is broken, the triggers doesn't work anymore and the objects that was in the inventory are not showing and the doors are opening weird in the opposite direction.

  • You need to instruct AC to reset your game back to its original state. Instead of the Scene: Switch Action, use the Engine: End game Action's Restart Game command to return to your game's first scene.

  • Thank you Chris for the last reply, you helped me alot.
    Now i have a problem with the Camera:Switch , it doesn't work anymore, i'm using Unity 2021.3.3f1 URP and AC 1.75.4, last time i used Unity 2020 and it worked but when i upgraded it doesn't work, do i have to change something with the MainCamera?

  • I manage to make it work, i put an Engine:Wait before the camera switch but it stays for a couple of seconds and it goes back to the First Person Camera.

  • If your Settings Manager's Movement method is set to First Person, then AC will switch back to the First Person camera automatically during gameplay. You can switch camera during cutscenes - but it'll revert back to the First Person camera afterwards.

    If you want to use a different camera during gameplay, use the Engine: Manage systems Action to set your Movement method to None - see the Manual's "First-person movement" chapter for details.

  • Thank you Chris, now it's working. But i have to uncheck the first person camera in the Inspector, also the simplecamera that i'm switching automatically uncheck on play, in Unity URP you must have both camera checked in Inspector to have post-processing effects. I'm going to use the standard render instead.

  • Post Processing is applied to the MainCamera - not any of the GameCameras (SimpleCamera, FirstPersonCamera etc) in the scene. They are used solely for position references for the MainCamera, which is the one that performs the rendering.

  • Yes, i forgot about that. Thank you Chris.

  • Can i add a sound when i'm jumping and a sound when i land on the ground?

  • Something like this should do it:

    using System.Collections;
    using UnityEngine;
    using AC;
    
    public class JumpAudio : MonoBehaviour
    {
    
        public AudioClip jumpSound;
        public AudioClip landSound;
        public AudioSource audioSource;
        public float minLandTime = 0.5f;
    
        private void OnEnable () { EventManager.OnPlayerJump += OnPlayerJump; }
        private void OnDisable () { EventManager.OnPlayerJump -= OnPlayerJump; }
    
        private void OnPlayerJump (Player player)
        {
            audioSource.PlayOneShot (jumpSound);
            StopAllCoroutines ();
            StartCoroutine (AwaitLanding (player));
        }
    
        private IEnumerator AwaitLanding (Player player)
        {
            float startTime = Time.time;
            while (!player.IsGrounded ())
            {
                yield return null;
            }
            float endTime = Time.time;
    
            if ((endTime - startTime) > minLandTime)
            {
                audioSource.PlayOneShot (landSound);
            }
        }
    
    }
    
  • Excellent Chris. Thank you very much.
    I have a question about subtitles. Can I make the subtitle not disappear and instead use a key to press it for the next subtitle to appear?

  • See the "Display subtitles forever?" option in the Speech Manager.

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.