Timeline after tuning works well, but not works playing the game

Following the course I have recorded the timeline and subsequently adjusted the turns and movements.
When I run the timeline, the ship moves fine. But when I press “play” to run the game, it ignores the timeline and
goes through the trajectory without the adjustments I made.
That could be happening?
Furthermore, I have had to repeat the recording of the timeline several times until it was acceptable to me.
Thanks!.

Hi arodrigu,

Unfortunately, I don’t know what might have gone wrong. Maybe I misunderstood your problem. Would you be able to record a video showing the issue?

Also, which version of Unity and which version of the Timeline package do you use? If odd things happen, there is a chance that there is a bug either in the editor or the package.

Hi, Nina. Thanks for your attention. Sorry for responding late, but I work during the day and do the course in the afternoons/evenings.
I’m going to record a video showing the issue and send you.
About the version of Unity and the version of the Timeline package that may be the problem, because I have updated Unity versions over time, thinking it was a good idea.
My current version of Unity is: 2021.3.30f1.git.11810317 Personal,
and the Timeline package is: 1.6.5.
I’m going to record a video with the issue and send it in another message.

Regards

Video_timeline

video showing the flight of the ship using the timeline

Video_play

video showing the flight of the ship using the play game

No worries. I’m not sitting 24/7 in front of my screen waiting for your answer. Reply when you have time. :slight_smile:

Regarding your videos, I assume the first one is what you would like to achieve, and the second one shows the problem. If so, the problem looks as if the rotation of the spaceship has not been defined in the very first keyframe of the timeline animation. In that case, the animated game objects often show an unexpected behaviour.

I would recommend to record the first keyframe with the initial position and rotation of your spaceship as seen in the game window while the game is not running.

Did this fix it?

About the videos, yes, the first is the one that shows how I would like to achieve and the second shows the problem.

I have tried to do what you tell me.
But in this way, the camera follow correctly the trajectory but the ship always looks forward, it does not rotate.
I think if I have broken any relationship between the camera and the ship in the Player Rig.

2023-12-14 21-06-42

I think if I have broken any relationship between the camera and the ship in the Player Rig.

Did you animate the Player Rig (= parent) only? If so, that’s what you were supposed to do. The children (= Player Ship and Main Camera) must not be animated.

Please check the ‘solution’ in this thread and my last answer in the same thread. It might be that there is a conversion issue between Euler angles and Quaternions.

If that did not work you could edit the rotation values in all keyframes manually.

And if you have a lot of keyframes, consider deleting and redoing the animation. That’s often faster than editing dozens of keyframes.

Yes, I animate only the Player Rig. On some occassions I have animated only the ship by mistake, but I have tried to correct it.
Tomorrow I will check the ‘solution’ in the thread and your answer.
About edit rotation values in all keyframes manually, no problem because I have captured the trajectory about five or six times.

I’m going to create the Player Rig again because I have the impression that the link between the camera and the ship was not right. The camera rotates in the trajectory, but the ship does not.

Anyway, I don’t see the option Interpolation → Quaternion when I tuning curves.

Where did you click the right mouse button? Did you try to click it while hovering over Rotation.y? Or in the curves window?

Are you able to update the Timeline package in Window > Package Manager? From what I see on Unity’s website, the latest version number is 1.8.6. You mentioned that you were using 1.6.5., which is much older.

I try to click in both. Over Rotation.y, show “Remove Curve”, and in the curves window, show “Add Key”.
No, I’m not able to update the Timeline package.


It is possible that it is a version problem. When updating the Unity version, all the textures, trees, etc. were misconfigured. In fact, the enemy turns out pink, because the shaders don’t work.

Maybe I should install the latest version of Unity and reload the project with this new version.
In the worst case, start the project again with the new version of Unity.

That pink colour indicates that the materials are broken, or that something in the material is missing, or that a material is missing.

In this course, we use the built-in render pipeline, not the HDRP or URP. Selecting the wrong render pipeline could break the materials.

Depending on the render pipeline in your project and the materials that are used in the project, you could test Unity’s HDRP Wizard:

https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@17.0/manual/Render-Pipeline-Wizard.html

That sometimes fixes certain issues with the materials/shaders.


I try to click in both. Over Rotation.y, show “Remove Curve”, and in the curves window, show “Add Key”.

Have you already checked the animation itself? In your screenshot, we are looking at the Timeline. However, the Timeline is linked to a ‘normal’ animation. It might be that you are able to open it via this menu:

image


Maybe I should install the latest version of Unity and reload the project with this new version.

You may do that but before doing that, make a backup of your project by duplicating the project folder. Save the duplicated folder somewhere else, maybe on an USB stick. To save some free space, you could delete the Library and Temp folders in the backup folder.

This way, if something goes wrong with the update, you still have your previous project state.

Yes, I think that I selected the wrong render pipeline (HDRP). I’ve tried to fix with HDRP Wizard, but it not worked for me. I have tried uninstall HDRP and URP, but it hasn’t worked either. I finally left it as HDRP even if looks bad.
As you have told me, I open the Animation and finally I’ve found Interpolation → Quaternion.
I have activated it (Quaternion), but in play mode it still does the same thing:
The camera rotates well but the ship is always looking forward.
bad.gif
It should look like this:
good.gif
That’s why I was thinking about whether to start the exercise from the beginning and with a new version of Unity. In case it was a problem of a conflict or configuration in Unity and this is how it was resolved.

I would recommend to delete the current animation and to redo it. Since the current one is not that complex, redoing it is probably faster than trying to find the issue in the animation itself.

Don’t create the entire animation but create the first few keyframes first, then check the animation whether you get the game problem again. If you don’t get the same problem again, record the rest of the animation.

Regarding the trees, check the website where you got them from. Maybe they are not compatible with the HDRP. In that case, you could look for other assets on Unity’s website.

Ok. I’m going to do that.
Regarding the trees, first I’m going to try to correct the animation problem and then do what you tell me.

Good night. Finally I mentioned the problem to a friend who works with Unity, and he reviewed the project for me.
The problem was that the camera object was a child of PlayerRig. Changing the relationship to be a child of PlayerShip fixed the problem.

modificacionCamara

Awesome! I’m glad the problem and solution were so simple. :slight_smile:

I have picked up the course and the video where I left off.
In the video the Main Camera is child of player rig, not playerShip. It was fine as before.
I have retested and disabling the script I discovered that it is the C# script that is causing this malfunction.
Tomorrow I will continue testing.

Finally I have found the error.
In the C# script, in the method processRotation, when I do the quaternion calculus, I set the value to:
transform.rotation not to transform.localRotation. It’s my mistake.

Thanks for all.

Privacy & Terms