Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ShizukaKun · Aug 18, 2015 at 01:54 PM · playersceneload

Loading player location in the same scene

i've been working on a game lately and i stumbled on a problem and that is loading my player from a platform to another , for example when he is done running trough the first platform from start to the end he will automatically jump to another and he is an example of the map : alt text

and i have every platform on a totally different scene separated;

so pls does any one have a good idea on how to load the player in each platform after we run trough it ;

thanks for your consideration and your time;

capture4.png (244.9 kB)
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Positive7 · Aug 18, 2015 at 02:09 PM 0
Share

How about a Spawn point at Begin and a Box Collider at the end with OnTriggerEnter load new scene?

avatar image Runalotski · Aug 18, 2015 at 02:29 PM 0
Share

You would want to make a player object into a prefab

then make an empty game object and make it into a prefab called spawnPoint

then make this script

 Public Transform player;
 Public Transfrom spawnPoint;
 void Start()
 {
      Instantiate(player, spawnPoint.position, spawnPoint.rotation);
 }

the Start Function runs once when the object is created (wich is when a scene is loaded or object is instantiated)

so by attaching this script to the levels of you scenes and dropping in the appropraite prefabs, it will spawn the player at the spawn point when the scene begins.

avatar image ShizukaKun · Aug 18, 2015 at 05:24 PM 0
Share

i m gratefully thankful for everyone ho answered my question , thank you ^^

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by kimardamina · Aug 18, 2015 at 04:33 PM

Was also thinking you just add triggers and make it instantiates on the next point and you save that point for the next time you open the same scene if you are putting everything on one same scene.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ShizukaKun · Aug 18, 2015 at 08:34 PM 0
Share

i used triggers as you said and it work perfectly except that he face the wrong direction when he get teleported from a position to other i tried using this line of code :

 player.transfrom.rotation = destination.transform.rotation ; 

but is does nit seem to work :/

avatar image
1

Answer by Youri1er · Aug 18, 2015 at 02:21 PM

Yes that's easy, you put an empty object at the start of your platform. You name it start.

On a empty object you put a script "spawnManager" in each scene. The spawn Manager script looks like this:

 public class Spawn_Manager : MonoBehaviour 
 {
     public GameObject Start_Spawn;
     public GameObject Player_Prefab;
 
     // Use this for initialization
     void Start () 
     {
         if(Start_Spawn != null)
         {
             GameObject.Instantiate(Player_Prefab,Start_Spawn.transform.position,Quaternion.identity);
         }
         else
             Debug.Log("Please set a start spawn point");
     }
 }

And at the end you have many option. You put a collider or trigger at the end to detect when he go in and Application.Loadlevel.

Or you make a second empty object at the end. And you make a distance test to know if you are next to him. and then Application.Loadlevel.

This works because when you Application.Loadlevel, in each scene SpawnManager instantiate the playerPrefab to the startEmptyPoint. You can make multiple spawnStart and choose a random number to select one of these, etc.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by Runalotski · Aug 18, 2015 at 02:29 PM

You would want to make a player object into a prefab

then make an empty game object and make it into a prefab called spawnPoint

then make this script

 Public Transform player;
 Public Transfrom spawnPoint;
 void Start()
 {
      Instantiate(player, spawnPoint.position, spawnPoint.rotation);
 }

the Start Function runs once when the object is created (wich is when a scene is loaded or object is instantiated)

so by attaching this script to the levels of your scenes and dropping in the appropraite prefabs, it will spawn the player at the spawn point when the scene begins.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Setting which scene to load based on if you've played before? 1 Answer

Loading player location in a scene 2 Answers

Network - Load For Late Players 1 Answer

carrying player data from one scene to the next 1 Answer

Load and Save Scenes with PlayerPrefs.Set/GetInt 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges