Timeline for Why I'm getting ArgumentException: failed to convert parameters when trying to load a scene?
Current License: CC BY-SA 4.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 12, 2018 at 13:44 | vote | accept | Daniel Lip | ||
May 12, 2018 at 13:02 | history | edited | Candid Moon _Max_ | CC BY-SA 4.0 |
added 393 characters in body
|
May 12, 2018 at 12:56 | comment | added | Candid Moon _Max_ | Let us continue this discussion in chat. | |
May 12, 2018 at 12:54 | comment | added | Candid Moon _Max_ | Because the scenes aren't related one to another in any way except that they are loaded at the same time. If you load the new scene, the reference to Player from scene to scene is lost because these scenes were unloaded, so you try to access the data that doesn't exist already. This activation event is called after the scene was loaded, thus even if you wouldn't get the exception. The player would be inactive because he was only enabled on the scene that was loaded additively. But in the saved state of The Space Station the player is disabled and you are loading that saved state. | |
May 12, 2018 at 12:50 | comment | added | Daniel Lip | I can't figure out why the Player when I drag it to the inspector is gone from the inspector when running the game. | |
May 12, 2018 at 12:49 | comment | added | Daniel Lip | Then when I'm running the game the Player in the inspector is gone before I'm getting the exception I hit Play the game start and the Player is gone here in this screenshot is when the game is running. And now if I will click on the START GAME button i will get the exception since the Player is gone imgur.com/a/oyEBrQ7 | |
May 12, 2018 at 12:46 | comment | added | Daniel Lip | Look here please this screenshot showing the unity3d editor my editor. See in the Hierarchy the Player is off. And this is what I drag in the right to the button Inspector to the On Click to the ActivatePlayer: imgur.com/a/CPPUlX5 | |
May 12, 2018 at 12:41 | comment | added | Candid Moon _Max_ |
From the second post I can assume that you don't get the ArgumentException anymore, right?
|
|
May 12, 2018 at 12:39 | comment | added | Candid Moon _Max_ | @BenziAvrumi You are missing the reference to object in that button. Could you describe what you see in the button component event when you get this error after scene load? Is the reference to the player still there? | |
May 12, 2018 at 12:20 | comment | added | Daniel Lip | Not sure how to explain it good enough. But when the Player camera is on it will be the main camera. That is why the player camera is off when running the game. | |
May 12, 2018 at 12:18 | comment | added | Daniel Lip | The problem is that in the scene i want to load i have a sky box and space station and more stuff i need to show with the main menu. So the active scene is the second one when running the game and i turned off the player so its camera won't be on and the main menu camera will be the main. That way i see the main menu with the second scene stuff. | |
May 12, 2018 at 12:15 | comment | added | Daniel Lip | My main problem is that in the main menu scene when I click the button it should load the second script. But in the second script I have Player a first person with a Camera. And if the Player will be set to true on then it will show me the player camera and I will be in the second scene when running the game. But I need to be in the main menu scene when running the game and then I need to set the player to true when loading scene: look at it here: gamedev.stackexchange.com/questions/158533/… | |
May 12, 2018 at 12:13 | comment | added | Daniel Lip | What I'm passing as Player in the Inspector of the button is an object from the Hierarchy object name Player. The problem is once I'm running the game the Player I dragged in the Inspector is gone removed from the inspector. Maybe the problem is that the button is in one scene but the Player object is in another scene ? | |
May 12, 2018 at 11:42 | history | answered | Candid Moon _Max_ | CC BY-SA 4.0 |