question

Zroot avatar image
Zroot asked

CS0246: Missing a using directive or an assembly reference,

Hi,

I have been working for over a day to try and install Playfab in Unity and I continue to get the CS0246 error. The install seemed to go great, the EditorExtensions created a nice setup that allowed me to download and login from the GUI on Unity. Looked exactly like the Tutorial and several videos I saw.

But, I have not been able use PlayFab. Any imports give me an error CS0246. Does anyone have anything that has worked for them?

Things I have tried and done:

1. I followed the instructions at this link: https://learn.microsoft.com/en-us/gaming/playfab/sdks/unity3d/installing-unity3d-sdk

2. Uninstalled and reinstalled then followed the instructions in the link above again.

3. Updated my Visual Studio Code and .NET. Retried step 2.

4. Updated Unity (now on 2021.3.10f1 LTS). Retried step 2.

5. Restarted my computer between all of these steps.

6. Made sure VSC could reference the project. (Project > Add Reference) and made sure that VSC could identify PlayFab. Retried step 2.

7. Regenerated Project Files for PlayFab in Unity (Edit > Preferences > External Tools > Regenerate Project Files)

Really at a loss here. If anyone has any experience with this please let me know. Would love to use and scale project with PlayFab.

,

unity3dsdks
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Zroot avatar image Zroot commented ·

Still have had no success. A few more tries that didn't work.

8. I just tried repeating the process on my laptop. With the same Unity version and updated VS 2019. Same results! Was really not expecting that one.

9. Deleted the csproj files then reran step 7.

10. Deleted files in the Library folder then restarted Unity.

Any other ideas?

0 Likes 0 ·
Zroot avatar image
Zroot answered

SOLUTION -- lets see if it holds. But for anyone who sees this. Basically, I had to go into my main scripts folder and inspect the scripts.asmdef file in the scripts folder. From there you have a section called Assembly Definition References. You can use the + tab to add a new entry and drag your PlayFab.asmdef file into that. That allows the files in the Scripts assembly to reference PlayFab.

I am baffled why from all the tutorials and stuff this was either overlooked (it wasn't) or wasn't automatically done here. Either way, it seems to be working now.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Gosen Gao avatar image
Gosen Gao answered

What is the version of PlayFab Unity Editor Extensions and PlayFab SDK you are using?

According to your description, you have installed the PlayFab Unity Editor Extensions successfully. After that, did the installation of the PlayFab SDK work properly? If it works fine, it should look like the picture in the section: Set your title settings.

If everything works fine, but the issue persists. Then it should be an issue between Unity and your IDE, you can try to use latest Visual Studio to do some test.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Zroot avatar image Zroot commented ·

Hi @Gosen Gao, thanks for the response. I did setup the title properly and it identified my account and game title and I selected those identified properties. The SDK installed is 2.151.220926. I updated it last night when it prompted.

When you say latest Visual Studio, do you mean 2022? I am running Community 2019 v16.11.19

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.