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
0
Question by Pentagon_Developer · Apr 02, 2019 at 05:42 PM · scene-loadingloadingsavingscene-switchingrespawn

Character selection with scene changing ,Charakter Saving mit Scenenwechsel

English My English is not so good but i try to explain it. I have two scences one for the charactermenu and one for the game. In my game scene is an GameObject where all my Prefabs are ( the characters ) and on top of it is the first script that you can see under the text. The script for the shop is very long but if it helps to solve my problems then i will sent it to. I tried it with DontDestroyOnLoad but that didnt help me out. When bouth things are in the same Scene then it works perfect but if they are in separated scenes it woudnt work. And my second problem is that I have a respawn button but when I press it everything settles and deactivates itself. The second Script is my Respawn Script but my first problem is more important. Thank s for reading and for understanding my bad Englisch. I am really sorry for that but i would be very happy if someone would answer my. German Hallo, Ich habe ein Charakterauswahlmenü von einem Freund programmiert bekommen. Das Script beinhaltet schon eine Speicherung der Charaktere zB. wenn man das Spiel neu startet bleiben die gekauften Charakter gekauft. Jedoch weiß ich nicht wie der Charakter gespeichert wird wenn man in eine andere Scene wechselt. Ich habe es schon mit DontDestroyOnLoad ausprobiert aber irgendwie will das nicht so funktionieren wie ich mir das vorgestellt habe. Um kurz mein Projekt zu erklären: Ich habe ein GameObject das dieses Script beinhaltet:

 private void OnEnable()
 {
     CharacterSelector.OnCharacterSelected += playerSelected;
 }

 private void OnDisable()
 {
     CharacterSelector.OnCharacterSelected -= playerSelected;
 }
 private void playerSelected(string characterName)
 {
     foreach(Transform child in transform)
     {
         child.gameObject.SetActive(child.name == characterName);
     }
 }


In dem GameObject sind dann meine Prefabs also die Charaktere. Wenn das Game Object in der gleichen Scene wie das Charakterauswahlmenü ist dann funktoniert alles und ich kann meine Charaktere problemlos auswählen aber sobalt sich das GameObject in einer anderen Scene befindet geht es nicht mehr. Wenn das Script für das Auswahlmenü wichtig ist um mir zu helfen dann poste ich es auch gerne nochmal rein, da es aber sehr lang ist wollte ich das erstmal keinem antun :)

Und mein 2 Problem ist das die Auswahl auch immer deaktiviert wird wenn ich auf Restart drücke Hier mein Restart Script:

 public void Restart()
 {
     SceneManager.LoadScene(SceneManager.GetActiveScene().name);
 }

Ich liebe es zu programmieren und würde mich über jede Antwort freuen, denn ich bin noch ein Anfänger und dementsprechend noch nicht so erfahren im programmieren. Ich weiß es sehr zu schätzen das andere sich die Zeit nehmen das Problem zu lösen und mir damit zu helfen. Danke :)

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 dan_wipf · Apr 03, 2019 at 10:39 AM 0
Share

please how the whole script. those two snippets do not provide enough information!

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

174 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 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 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 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 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

Save and load scene from file 2 Answers

Loading and Saving High Score 1 Answer

LoadScene not working 0 Answers

How Do I Get a Reference To An Object In Another Scene In A Field In The Inspector? 4 Answers

Virtual Pet Game 1 Answer


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