简体   繁体   中英

How do I make my C# code for Unity in Visual Studio look/work like in the tutorial (picture)

I'm trying to make a mobile game with Playfab and Unity.
It's my first time using Unity and Visual Studio. Usually I'm only using VS Code.
The code is working, but it's not looking like in the tutorial and I also don't get the code recommendations of Playfab when typing my code.
So basically I want my code to look like this:

我正在观看的教程中的代码示例

instead of this:

这就是我的代码的样子

Maybe I've done something wrong when importing Playfab or installing Visual Studio.
I've tried reinstalling Visual Studio (didn't work) and I have no idea how to go on now.

Those lines are commented because of Unity Platform Dependent Compilation feature. They only work when in a specific platform, which is Android. Simply switch the target build to Android to make it work.

For anyone wondering, I figured it out myself by now.

You have to go in Unity -> Edit -> Preferences -> External Tools
There you select Visual Studio at External Script Editor
And check everything at "Generate.csproj files for"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM