Forum begins after the advertisement:


Scene Transition change the scene rapidly

Home Forums Video Game Tutorial Series Creating a Metroidvania in Unity Scene Transition change the scene rapidly

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #16021
    pepecry
    Level 6
    Participant
    Helpful?
    Up
    0
    ::

    Hello everyone. I just build a new scene and it come out with some error and I got some question want to ask too.
    First is the error. I created 2 scenes transition and the first one work ok. The second one is like the below picture
    Second scene transition
    I do the same as the first transition but when i jump to it, the scene change rapidly like the video
    Video demo error
    In the video i has show something you want to check like the build setting, the transition to variable, the position of the starting point.
    And for the question, I want to ask that how can I make sure that if my player jump of from this scene, if will fall down in correct position if there is 2 or more scene transtion and start. Like in the video 2 got 2 scene transition and if I go up and then go down ( after I fix the error ) how can I make it drop down in the start point of the second scene trasition.
    Thank you so much for the series

    #16029
    Chloe Lim
    Level 9
    Moderator
    Helpful?
    Up
    0
    ::

    Hi,
    Do send me your script for SceneTransition to see if the issue is possibly within the script itself

    #16030
    pepecry
    Level 6
    Participant
    Helpful?
    Up
    0
    ::
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.SceneManagement;
    
    public class SceneTransition : MonoBehaviour
    {
        // Start is called before the first frame update
    
        [SerializeField] private string transitionTo;
        [SerializeField] private Transform startPoint;
        [SerializeField] private Vector2 directionExit;
        [SerializeField] private float exitTime;
    
        private void Start()
        {
            if (transitionTo == GameManager.Instance.transitionFromScene)
            {
                Move.Instance.transform.position = startPoint.position;
                StartCoroutine(Move.Instance.WalktonewScene(directionExit,exitTime));
            }
    
        }
        private void OnTriggerEnter2D(Collider2D _other)
        {
            if (_other.CompareTag("Player"))
            {
                GameManager.Instance.transitionFromScene = SceneManager.GetActiveScene().name;
                Move.Instance.playerStateList.incutscene = true;
                SceneManager.LoadScene(transitionTo);
            }
        }
    }

    here is the scene transition script

    #16031
    Chloe Lim
    Level 9
    Moderator
    Helpful?
    Up
    0
    ::

    Hi, your scene transition script seems fine
    Try this,
    Check where is the child start point for your scene transition in the uppertunnel scene is, it can affect where the player spawns in the scene, send the screenshot of it here too

    #16032
    pepecry
    Level 6
    Participant
    Helpful?
    Up
    0
    ::

    here is the image of the startpoint
    startpoint in scene
    startpoint in hierachy

    #16035
    Chloe Lim
    Level 9
    Moderator
    Helpful?
    Up
    0
    ::

    Hi, the issue could be these things:
    – There is a duplicate player in the UpperTunnel scene, so there might be a clash with that, there should only be one player prefab present within all the level scenes
    – The start point might be causing the player to fall back down the previous scene, so try to adjust it such that the player will land on the platform

    #16036
    pepecry
    Level 6
    Participant
    Helpful?
    Up
    0
    ::

    Hi so it definitely because of the startpoint postion. About the player dublicated. Is that you mean that I dont need to put the player in every scene? Does I just need to put it in the start scene?

    #16038
    Chloe Lim
    Level 9
    Moderator
    Helpful?
    Up
    0
    ::

    Hi
    Yes that’s right, there should only be one player game object at the scene where the game starts at

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: