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 /
  • Help Room /
avatar image
1
Question by ilovenerdwins87 · Dec 21, 2015 at 07:59 PM · javascriptscene-loadingtransform.positionrpgteleport

Make player spawn at point when loading a scene.

In my game I'm making, I have a top down perspective. Its RPG style and when I have the player enter a building, it loads a new scene and starts the player at the door inside the house. Awesome. The trouble I'm having is when you exit that building, it spawns the player at the beginning point of that scene, not outside the building entered. I've seen tutorials about transform positions, and using don't destroy on load and even someone suggested using prefabs and teleporters I am new at using the Unity scripting references. I am just having a hard time with this, and its discouraging. Because of changes in Unity 5, many of the scripts don't function properly. Can someone help me understand how to write a script for this? I mainly use Javascript

 if(coll.gameObject.tag == "ExitDoorMom")
 var player = GameObject("ExitDoorMom");
 Application.LoadLevel(0);

This script (even though unity says its obsolete in 5) works for me. It allows me to load the scene. What can I add to it to load a new scene, and once the scene is loaded, move the player to a specific position.

I'm not trying to have all the work done for me, I'm trying to learn. Any help would be much appreciated! Thanks again!

Comment
Add comment · Show 1
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 itsharshdeep · Dec 22, 2015 at 05:00 AM 0
Share

The easiest solution in my $$anonymous$$d is :-

You dont need to use don't destroy on load . Do destroy the player with previous scene. And when the next scene loads then the player should be present the position which is required by you..

No??? Is this okay for you?

this will not work if you have some other requirements. Then we have to think something else

0 Replies

· Add your reply
  • Sort: 

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

38 People are following this question.

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

Related Questions

Scene Loading from Main Menu Player Transform not moving 0 Answers

position is not a member of Object and GetChild() 1 Answer

Scene Change 1 Answer

Need a Script for Changing Scenes after pressing E to open locked door once a key has been found. 0 Answers

[Newbie in js] "wait" and teleporting devices 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