Mirror/doc/Articles/General/PlayerControllerToIdentity.md

44 lines
1.3 KiB
Markdown
Raw Normal View History

# Changing playerController to identity
If you need to fix up a project after `NetworkConnection.playerController` was changed to `identity` these instructions should be helpful.
2019-09-18 14:02:39 +00:00
1. Open your Unity project and look for Assets/Mirror/Runtime/**NetworkConnection**:
![Project window in Unity](pc2i-1.png)
2019-09-18 14:02:39 +00:00
2. Open this file in Visual Studio or Visual Code from Unity and look for these lines:
![Code snip in NetworkConnection.cs](pc2i-2.png)
The line numbers could be off a bit if minor file changes happen above them after this document was written.
2019-09-18 14:02:39 +00:00
3. Comment the last line shown:
```cs
// public NetworkIdentity identity { get; internal set; }
```
2019-09-18 14:02:39 +00:00
4. Double-click and then right-click `playerController` and select Rename:
![Start of Rename process](pc2i-3.png)
2019-09-18 14:02:39 +00:00
5. Change `playerController` to `identity` and click Apply:
![Finishing the Rename process](pc2i-4.png)
2019-09-18 14:02:39 +00:00
Visual Studio will now have applied the change throughout your project, but you're not done yet!
2019-09-18 14:02:39 +00:00
Without using the replace feature this time, simply retype the name back to `playerController` and un-comment the last line in the code image that you commented out in step 3.
Your code should now look like the code image again.
![Code snip in NetworkConnection.cs](pc2i-2.png)
**Save your work!**