Errors following creation of prefab variants

,

This is related to the RPG course on Udemy. I created two prefab variants of my original player prefab (player and enemy) and replaced the original player character with the new variant. Before doing this, everything was working as expected. However, after making this replacement, I began experiencing the following errors:

  1. The follow camera now moves faster than the player. Both the camera and the player still respond to mouse clicks and move in the right direction, but they are out of sync.

  2. My player movement function that calls StartAction from the action scheduler is throwing a null reference error following every click:

Sorry about the bad cropping; line 46 is GetComponent().StartAction(this):
image

Line 34 is GetComponent().MoveToNonInteractable(hit.point):

Line 17 is if (MovementRay()) return:
image

  1. When my “interact” animation is triggered, at the end of the animation the player freezes in place. Clicking away with the mouse causes the character to begin moving again.

Everything was functioning smoothly before the creation of the variants. I tried removing and replacing all the script components at both the root prefab and new variant level, as this seemed to work for someone else who saw some errors after doing this. Nothing I’ve tried has worked though.

Has anyone else run into anything like this? I’m using 2021.1.17f1

The error is saying that it can’t find the ActionScheduler. Make sure that both the Player and the Enemy prefabs have an ActionScheduler.

1 Like

Thank you for responding to this!

The variants did have that script attached - the issue was elsewhere. I’ll explain in case anyone else runs in to this. Somehow, during the process of producing the variants, a NavMeshAgent and a number of scripts got attached to the prefab model that was childed to the empty parent object “Player.” Both NavMeshes were moving and scripts running in response to player input, and the follow camera was trying to follow both at once. Removing all those components from the model so that they are only on the parent object got everything back to normal.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.