Improbable Icon

Forums

Player won't move anymore - fps driver issues?

unity

#1

Hi,
Sorry but I totally messed up the fps project I think.
I added some stuff and try to revert to what it was but I can’t get my guy to move anymore.

When I start a local deployment, the fpsdriver component is unchecked for my player in the inspector,
When I check it manually it complains on the line
if (health.Data.Health == 0)
But I checked the spatial’s inspector and it does have a health component
it is also declared on fps driver as a reader
I littered the fpsdriver with debug logs and OnEnable doesnt seem to run ever.

Any help would be appreciated.


#3

Just found this
The GDK manages the lifecycle of all MonoBehaviours that contain at least one field with a [Require] attribute. It ensures that these MonoBehaviours are disabled for

  • all Prefabs stored inside the Resources folder of your Unity project
  • all MonoBehaviours on instantiated GameObjects that have at least one requirement not fulfilled during runtime Whenever a MonoBehaviour is disabled, all fields decorated with the [Require] attribute are null and you can not use them anymore as soon as OnDisable is called on that MonoBehaviour.

and found the offending line in my script
[Require] private UserControls.Requirable.Writer UserControlsWriter;

Not sure why its failing yet but its progress…


#4

Ok its working now,

I didn’t realize what adding the component in the entity template is for.
If I am understanding correctly its to give which workers access to the component and its a requirement to inject the writer/readers into it and if it doesn’t get everything it nulls all of them in the script.

Sorry for the trouble…