An open API service indexing awesome lists of open source software.

https://github.com/isitt77/scenetransitionscripts

Transition scenes setting Player position and Animator Vector2 in scriptable object (no singleton)
https://github.com/isitt77/scenetransitionscripts

scenetransition scriptableobject unity2d

Last synced: 18 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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