Improbable Icon

Forums

Health pick-up tutorial Error/Troubleshooting


#1

I finished the getting started section, & was super excited to add my
first feature, but I’ve run into an error.

The problem I’m having can be located at the Health pick-up tutorial under the
“Entity templates” section. Upon opening the “FpsEntityTemplates”
class & entering the following code, i get an error stating that “Pickups”
doesn’t exist in the current context, on line 5.

I’ve both generated code & (forced) code. The error persists. I already
defined the schema in /schema/pickups/health_pickup.schema. I’m using
Unity v2018.2.14f1 & Mac OS 10.14.

Hopefully it’s just something I’m doing wrong. :slight_smile:


#3

Hi @Kirk_Land,

I believe that is a namespacing issue and you’ll need to have a using Pickups; statement at the top of the FpsEntityTemplates class in order to pull in these components.

Would you be able to add using Pickups; to the top of this file and see if you’re then able to continue?

If this is the issue I’ll make sure to get the docs updated as this step isn’t obvious!

Hope that helps!
- Ieuan


#4

Hey @leuan,

I had already tried that a few days ago, & just tried it again, it doesn’t work.

Thanks, Leuan!


#5

Hey @Kirk_Land, could you try running the ‘Generate code’ job and let me know what the output is please?

SpatialOS > Generate code

Thank you!


#6

Sorry for the long wait.

After running “Generate Code”, I get the following output:

  • Generating Code… (Debug.log)
  • The output folder does not match the expected output files. all files will be regenerated. (Debug.log)
  • The name ‘Pickups’ does not exist in the current context (Error)
  • Lastly, I get 4 warning messages for fields that aren’t ever used. (Warnings)

Thanks!


#7

Hi @Kirk_Land, I’m just starting out with this asset as well and ran into the exact same issue!

For me it was because I created and put the Pickup schema file inside workers/unity/schema, but it needs to go outside the Unity project folder. So maybe you just need to put the Pickup.schema file in gdk-for-unity-fps-starter-project/schema directory in order for the Generate Code function to build the Entity.

Good luck!


#8

Thanks for this, I figured it out. I had placed the file in the gdk-for-unity/schemas, not the gdk-for-unity-fps-starter-project directory. I feel bad now. :slight_smile:


#9

Glad to hear you’ve sorted it out and don’t worry about asking questions! :slight_smile: