Forum begins after the advertisement:
January 15, 2024 at 1:01 am #13085
so when going back and forth through the scene transitions it gives me this error:
NullReferenceException: Object reference not set to an instance of an object PlayerController.Move () (at Assets/Scripts/PlayerScripts/PlayerController.cs:127) PlayerController+<WalkIntoNewScene>d__28.MoveNext () (at Assets/Scripts/PlayerScripts/PlayerController.cs:112) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <5879d8d225474494bcffdfe64965038e>:0) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) SceneTransition:Start() (at Assets/Scripts/SceneScripts/SceneTransition.cs:20)
here is all my scripts this error is attacking.January 15, 2024 at 1:12 am #13086
Hi Ultimate Scripted, thanks for making your post here. Your Imgur images are probably set to private or to prevent embedding, that’s why they are not showing up on the post.
Can you try re-embedding the images? Or you can paste the codes as text here.January 15, 2024 at 1:39 am #13088
sorry i was a little confused on how to use imgur and i embedded the links before posting to public.
ill just repost code pictures here:
NullReferenceException: Object reference not set to an instance of an object PlayerController.Move () (at Assets/Scripts/PlayerScripts/PlayerController.cs:127) PlayerController+<WalkIntoNewScene>d__28.MoveNext () (at Assets/Scripts/PlayerScripts/PlayerController.cs:112) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <5879d8d225474494bcffdfe64965038e>:0) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) SceneTransition:Start() (at Assets/Scripts/SceneScripts/SceneTransition.cs:20)January 15, 2024 at 11:35 pm #13097
No problem. I’ve cleaned up your posts. To embed an image, you just need to leave the URL on a separate line like this:
Your post content https://imgur.com/a/0CIbonD
For your code, I suspect you are missing the following line in
rb = GetComponent<Rigidbody2D>();
So when you do
rb.velocity, you are essentially doing
null.velocity, which is what is causing the error.
We have a video that explains null references in more detail:February 11, 2024 at 1:33 am #13290
Okay i am back, i had stopped for finals week in school but thats now over and ive solved the issue, so somewhere in my cameramanager script i was relating to a component, the framingtransposer but it doesnt exist as an actual component in cinemachine or something. when taking away that references the scene transition works! but now i have another problem. i moved onto the part where he adds the vertical transitions and for some reason two things happen, first my player teleports back and forth from both scenes unable to break free but this only happens when the player is coming from a scene thats supposed to be beneath the one its jumping up too, and secondly when dropping down to that very scene it doesnt break and teleport back and forth but it does draw my player directly on the camera so while its there you cant see the player, i will provide a video of both of these things happening.February 11, 2024 at 1:44 am #13291February 11, 2024 at 10:14 am #13295
For the infinite teleport, check both the triggers that are involved in teleporting you to the next level. Are there components you’ve added that should not be there?
If you are unable to find anything amiss, screenshot the Inspectors of both GameObjects and show it to me.February 12, 2024 at 9:10 am #13313
Nothing seems to be wrong. heres a picture of both my transitions:
Oh and i know the exit time and direction for forest room 3 is incorrect i was just testing out different values because the original ones werent working so that why its all zero right nowFebruary 12, 2024 at 1:08 pm #13317
Is your Start Point for one of the maps inside the Box Collider of one of the Scene Transition objects?February 13, 2024 at 1:29 am #13324February 13, 2024 at 11:16 pm #13326
Can you move the start points further away from the collider to see if it fixes the issue? For example, in your first scene, the start point is right above the transition box. Perhaps you can move it onto the platform to the right? So when the Scene starts, your character won’t fall into the trigger right below.
Let me know if this fixes things.February 18, 2024 at 10:21 am #13346
Ok so that worked! i can now go from the bottom transition to the top (scene 3 to scene 1) with out it rapidly switching back and forth. but the issue for the player being drawn on the wrong layer is still here. when going from top scene (scene 1) to the bottom one it will still draw it (the player) onto the camera even though the player is there i cant see it. ive also created another problem where i had re-made my boundings box colliders which broke my other transition and now when going into scene one it duplicates the camera stuff over to that scene instead of just switching, it was stupid of me to make the platform of where the player walks into a child of the bounding boxes and i had made that into a prefab when i realized this gave would give me complications it was already to late because i had deleted that prefab and then it destroyed the ground for scene 2 now resulting in these issues. i kinda wanna just restart everything now 😞. but besides me being stupid thanks for the help i very much apreciate it.February 18, 2024 at 12:22 pm #13347
Ultimate, glad your issue was resolved. For the layers issue, if you need help fixing it, you can take a video of the issue and I’ll pinpoint some things you can try to resolve it.
I don’t suggest restarting the project! If you don’t figure out how to fix your issue in this project, it might just reoccur again when you restart the project!
- You must be logged in to reply to this topic.