Improbable Icon

SpatialOS Discourse Forums

Health Pack tutorial Error

I have completed the fps starter project and was working on health pack tutorial but i faced an error in HealthPickupClientVisibility script . It is giving many compilation errors in the code Plz Help.

Hi @rajatkhanna,

In the latest versions of the FPS starter project, the WorkerUtils class is name-spaced with Fps.Config so you’ll need to add a top-level using Fps.Config; to your HealthPickupClientVisibility script.

I’ll let the team know that this does not match up with the code snippets any longer.

Would you be able to do a similar check on the health pickup namespace?

If that looks correct please could you follow this guide on adding schema source directories and click SpatialOS > Generate code and let me know if there are any errors?

Good luck!

Hi @Ieuan,

I had the same problem and adding .Config fixed that error. The code snippet also seems to contain another error: “The type or namespace name ‘Update’ does not exist in the namespace ‘Fps.HealthPickup’” It seems to be related to the OnHealthPickupComponentUpdated function…

Thanks for your help! (I am seeing your posts and solutions peppered throughout the forum and really appreciate them!)

All the best,

Hey @owen.brierley,

I just had a run-through of the tutorial myself and realised what the issue is; the HealthPickup class is mistakenly being attributed to the Fps namespace when it is actually part of the Pickups namespace.

If you use the fully qualified name then this is no longer an issue and your code should compile.

private void OnHealthPickupComponentUpdated(Pickups.HealthPickup.Update update) { ... }

@rajatkhanna, I believe that this is probably the same error you were experiencing.
I’ll let the team know about this and get the docs fixed.

Many thanks,

Hi @Ieuan,

Thank you for this. I will need to learn more about the naming conventions in SpatialOS!

It seems that this is a multi-pronged issue where solving one problem opens another puzzle.

I am now getting an error that “the name ‘WorkerUltils’ does not exist in this context” in relation to the OnHealthPickupUpdated function. I double checked the entityTemplate code as that was the only place I could find any reference to a workerutils call…


All the best,

Whoops! The line being referenced in the error is:

I will do some digging and will see if I can figure out, but if it is something obvious, please chime in!

All the best,

@Ieuan !!!


Okay, so like the previous problem the issue boiled down to the fully qualified name. It seems that if you change [WorkerType(WorkerUtils.UnityClient)] to [WorkerType(Config.WorkerUtils.UnityClient)] Unity is happy again.

I rebuilt the whole thing on an install of VS 2019 that had proper problem solution hinting, and so I wish I could claim I was clever, but I had intelligence augmentation. I, personally, welcome our robot overlords… :slight_smile:

Hope this can help others who are working through this.

All the best,

1 Like