Character head poses wrong after loading a save
-
- Posts: 6
- Joined: Wed Nov 13, 2024 4:27 pm
Character head poses wrong after loading a save
Hi, my game saves in the editor, but when I load the game, the character (a cat) is standing with her head/nose pointed straight down at the floor. She can run and jump, but she only lifts her head (it snaps up) when I move the camera around to the side and front of her face. Facing the front 180 degrees, her head is up and normal; when the camera is behind her, her head is down. Is there a solution? I had a position and animation saver on the main prefab for the character, but removed it, and it still happens. Thanks in advance.
Re: Character head poses wrong after loading a save
Hi,
If you removed the savers and it still happens, then we know it's not the animators. This means it's probably nothing to do with the save system either, but with loading the scene with the cat in it. Can you try reloading the scene outside of the save system? For example, you could add a script like this to the scene. Then press F1 to test it.
If you removed the savers and it still happens, then we know it's not the animators. This means it's probably nothing to do with the save system either, but with loading the scene with the cat in it. Can you try reloading the scene outside of the save system? For example, you could add a script like this to the scene. Then press F1 to test it.
Code: Select all
using UnityEngine;
using UnityEngine.SceneManagement;
public class ReloadSceneOnF1 : MonoBehaviour
{
void Update()
{
if (Input.GetKeyDown(KeyCode.F1))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
}
}
-
- Posts: 6
- Joined: Wed Nov 13, 2024 4:27 pm
Re: Character head poses wrong after loading a save
Thanks for the response. Unfortunately when my partner saved a copy of the script, it apparently locked up the project and it cannot run or build. It's not in a scene, just saved as a script, he said.
Re: Character head poses wrong after loading a save
Hmm, putting that script in the project shouldn't affect anything. Adding it to a GameObject, on the other hand, will make it so that when you play the scene and press F1 it reloads the scene.
Maybe something else was broken that was waiting for a recompile? Putting the script in the project would tell Unity to recompile all scripts.
Try going back in version control to an earlier version.
Maybe something else was broken that was waiting for a recompile? Putting the script in the project would tell Unity to recompile all scripts.
Try going back in version control to an earlier version.
-
- Posts: 6
- Joined: Wed Nov 13, 2024 4:27 pm
Re: Character head poses wrong after loading a save
Thanks for the reply. The error says "The name 'SceneManager' does not exist in the current context". When reopening the project, it opened in safe mode.
We use sectoring, rather than scenes, which may be why?
I don't understand how the save would affect the pose of the quadruped's head, and was hoping you might know why. It's weird, right? Any input is appreciated.
We use sectoring, rather than scenes, which may be why?
I don't understand how the save would affect the pose of the quadruped's head, and was hoping you might know why. It's weird, right? Any input is appreciated.
Re: Character head poses wrong after loading a save
That should be valid code, although you can change the line in the script to this in case your project has a conflicting script named SceneManager:
Does a script control your quadruped's head, for example to look at or follow a target? If so, maybe that target isn't loaded or the script can't find it.
Code: Select all
UnityEngine.SceneManagement.SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
-
- Posts: 6
- Joined: Wed Nov 13, 2024 4:27 pm
Re: Character head poses wrong after loading a save
yes, we have look at and aim scripts on the character. I'll add them to the multi active saver and try it. Thanks again
edit: i mean the component saver, whose actual name eludes me
edit: i mean the component saver, whose actual name eludes me
-
- Posts: 6
- Joined: Wed Nov 13, 2024 4:27 pm
Re: Character head poses wrong after loading a save
Still loads with head down
-
- Posts: 6
- Joined: Wed Nov 13, 2024 4:27 pm
Re: Character head poses wrong after loading a save
Now her head is staying up. Not sure what changed it, but our code guy changed seemingly unrelated code, and I added more components to the saver. Here's hoping the fix is permanent. Still confused, but....
Thanks again for your help, Tony Li!
Thanks again for your help, Tony Li!
Re: Character head poses wrong after loading a save
Glad it's working now at least!