Skip to content

isitt77/SceneTransitionScripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SceneTransitionScripts

These are scripts that have been modified from a tutorial showing how to set the position of Player game object in the next scene using a scriptable object.

Modifications include:

  • Keeping fields private and using public getter methods to pass fields from one script to another.

  • Adding field for Player Animator component to have access to the Animator’s GetFloat().

The main flow of logic is…

  1. The game object with collider set to trigger next scene will have fields to set the Player position (a Vector2) for the next scene and get the X and Y float values of the Animator Vector2 (to get the direction Player was facing when collider was hit).

  2. The Player position Vector2 and the Animator Vector2 values are stored in a scriptable object to be used in the next scene.

  3. The stored values are passed back into the Player (Movement) Controller in the Start() (…or Awake() ) so that the Player game object spawns in the specified location set and is facing the same direction as they were in the previous scene.

Here is the original tutorial from Mr. Taft Creates…

https://www.youtube.com/watch?v=wNl--exin90&list=PL4vbr3u7UKWp0iM1WIfRjCDTI03u43Zfu&index=30

About

Transition scenes setting Player position and Animator Vector2 in scriptable object (no singleton)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages