spatialos / gdk-for-unity-fps-starter-project

SpatialOS GDK for Unity FPS Starter Project
https://gdk.improbable.io/spatialos-gdk-unity
MIT License
198 stars 75 forks source link

Assembly Refernce Error #252

Closed tjones0808 closed 4 years ago

tjones0808 commented 4 years ago

We are accepting issues and we want your feedback.


Description

Describe your issue. Seems like it can find the correct reference. Am i missing something? I am following the tutorial directly.

Assets\Fps\Resources\Prefabs\UnityClient\HealthPickupClientVisibility.cs(26,65): error CS0234: The type or namespace name 'Update' does not exist in the namespace 'Fps.HealthPickup' (are you missing an assembly reference?)

Assets\Fps\Resources\Prefabs\UnityGameLogic\HealthPickupServerBehaviour.cs(9,17): error CS0103: The name 'WorkerUtils' does not exist in the current context

Expected behaviour

I expect the code to build.

Current behaviour

Possible solution

Steps to reproduce

1. 2. 3. 4.

Environment

The setup health tutorial
zeroZshadow commented 4 years ago

Does the assembly definition for your files include a reference to the Improbable.Gdk.Generated asmdef?

You seem to have put the source files in the Resources/Prefabs folder. This might not be included by the default Improbable.Fps asmdef that is included in the project.

It's location is in Assets/Fps

tjones0808 commented 4 years ago

Ok, moved to correct file locations. WorkUtils is okay but still can't find the HealthPickup.Update method.. Thanks for the help!

shanepadgett commented 4 years ago

Ok, moved to correct file locations. WorkUtils is okay but still can't find the HealthPickup.Update method.. Thanks for the help!

That's because there is a namespace collision. HealthPickup is also a namespace under FPS as well as a class under Pickups. Simple fix is to change the signature to private void OnHealthPickupComponentUpdated(Pickups.HealthPickup.Update update) so that you explicitly access the HealthPickup class.

I definitely do think this is an issue with the documentation that should be fixed. The tutorial cannot be completed as-is with copying the code.

jamiebrynes7 commented 4 years ago

Hey @tjones0808 & @shanepadgett, thanks for the report!

We've updated the code samples on the health pickups tutorial to fix both the namespace collision issue and the WorkerUtils issue.