- Home /
No collision detection after reloading the scene
So when the player dies in my game i want to load the current level to start over but what happens is the scene loads and non of the collides work and the player keeps falling through the plane
so when my player dies i call death() witch adds one to the death count and loads the current scene again.
public static void death()
{
Death++;
i = SceneManager.GetActiveScene().buildIndex;
SceneManager.LoadScene(i);
}
the other version looks like this
public static void death()
{
Death++;
i = SceneManager.GetActiveScene().buildIndex;
PlayerPrefs.SetString("lastlevel", SceneManager.GetActiveScene().name);
SceneManager.LoadScene(3);
}
and then when that scene loads
void Start () {
le = PlayerPrefs.GetString("lastlevel");
}
void Update () {
s.value += 20;
s.value += 20;
s.value += 20;
s.value += 15;
s.value += 25;
System.Threading.Thread.Sleep(500);
SceneManager.LoadScene(le);
}
the weirdest thing is it always works the original start up but when i go to reload the scene it dosn't work.
Please, provide the code responsible for reloading the scene, and the components related to the collision detection (colliders & rigidbodies)
i have just put some of the code there i have also tried adding a loading scene in between so it loads the loading scene and then the level again but i have the same results.
Did you find any solution to this problem? I too have the same issue with my board game. There is a game board with static non-convex mesh collier. And pawns have dynamic colliers. When the game scene loads first and second time, pawns move on the game board with out any issue. When the game scene is reloaded the third time, pawns just fall through the game board!
Note: I am Instantiating Pawns in Awake function.
Answer by warpmanih · Apr 24, 2017 at 02:51 PM
I found an answer to my problem. So what i did was I selected the game-objects that were not colliding and added them to the player layer because the player was not colliding with the floor of my game. this fixed the problem. all credit for this answer goes to Daniel he helped me find this solution at a programing event. he also said, "that there was probably something wrong with my code" - but we could not find any thing so this is the solution he came up with.
Answer by runner409 · Jan 27, 2017 at 10:11 AM
I am having the exact same issue. I even tried recreating the scene from scratch, but to the same effect.
The only thing that I have found that works....is to recreate the entire project.
I know, it isn't a solution, and it's incredibly frustrating, but I've been looking for two days and this is the only mention I have even seen of someone having this issue.
yea i have tried recreating the whole scene too but i have the same result. the weird thing is that non of my other unity projects do this.
Your answer
Follow this Question
Related Questions
Tree colliders not working?!? 1 Answer
Loading Scene on a series of events 2 Answers
Load scene on button press 4 Answers
obb apk scene load fail 1 Answer
My life counter is not updating 1 Answer