When returning to the main scene after the transition, the first hit decision reacts.

Asked 1 years ago, Updated 1 years ago, 60 views

I'm a beginner at Unity 3 months.
I'm making a 2D RPG quiz.
There are several characters standing scattered on the main field
Each time the player hits the opponent (character), it changes to a quiz scene, solves the quiz, and presses the button to return to the main field.It's a game where you repeat it.

The position and proliferation of the player when returning to the main?I managed to do things like singleton, but when I returned to the main scene, the player and the other person (character) hit again and immediately transition to the game scene.

Change the character OnCollisionEnter 2D to stay, Exit, or
I've tried a lot of other things like discarding the collider during scene conversion and searching the web in GetComponent().enabled=false; but I can't proceed at all.

I was a complete amateur at programming, and I made it only with the web and books.
I'm sorry if the question sentence is difficult to understand.
I'm sorry for the poor writing and content of an amateur, but
Thank you for your cooperation.

unity3d

2022-09-30 21:46

1 Answers

It seems that there are characters left, so they collide again.

I think it's better to prevent another collision before the first win decision process, i.e., move on to the quiz scene.When returning to the main scene, depending on the timing, the winning decision may occur first.

As for not colliding again, how about deleting the game object itself for that character that is no longer needed?If there is any inconvenience in deleting it, I think it is possible to move the character to a place where the winning decision never occurs.


2022-09-30 21:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.