Working with Unity
Answered
Hi,
I've started working with unity a couple of days ago and I'd like to use Rider to make the Unity but I cannot make it work:
I've added several debugging messages but none are showing on the Unity console to add the Unity Project to the Rider soultion I've created a new solution with Unity template and linked the Unity files to the Solution, I'm not even sure if this is the correct way to do it.
Now even after building the project Unity doesnt load the changes.
eg:
EditorGrid.cs
using UnityEngine;
namespace RiderPlatform.Scripts
{
[ExecuteInEditMode]
public class EditorGrid : MonoBehaviour {
void Start() {
Debug.Log("Start2");
}
void Update () {
Debug.Log("Update2");
}
}
}
I'm on Rider 2018.1.2
Also whenever I try to attach to the Unity process I'm getting this error:
Input/Output redirection disabled: Debugger is attached to an already running process
D:\Tools\JetBrains\apps\Rider\ch-0\181.4952.297\bin\runnerw.exe D:\Tools\JetBrains\apps\Rider\ch-0\181.4952.297\lib\ReSharperHost\JetBrains.Debugger.Worker.exe 59941
I've found something online, tought I could find a solution for that.
Thanks!
Please sign in to leave a comment.
From what you've written, it sounds like you've used the Unity Class Library template to create a solution from within Rider. I suspect this isn't what you're after. This template is used to create a .dll that you can then add to an existing Unity project to provide extra functionality, but isn't intended to allow you to edit and debug an existing Unity project.
You probably want to create a project in Unity first, and then use Rider as the external script editor for this. You can do this by creating the Unity project and then double clicking on a C# file. Unity will then generate a .sln file and .csproj files that Rider can open.
However, the first time you do this, you need to make Rider the default external script editor. You can do this manually in Unity's settings, but the easiest way to do this is to just double click a C# file and let Unity open the current default editor (MonoDevelop or Visual Studio). Unity will generate the solution files as part of this process - just switch to Rider and load them. Rider will then install a small plugin into your project which will set everything up for you. Just switch back to Unity and let it load the plugin and then you're all set. You'll only need to do this once - after Rider is set as the default editor, Unity will use it for new and existing projects.
The message you get when attaching the debugger is not actually an error, but an informational message. Because you're attaching to an already running program (the Unity editor), Rider is not able to redirect input or output in the console window - this only works when Rider can launch the program being debugged.
By the way, I've raised an issue to make this Console message a bit more user friendly: RIDER-17412
Thanks for the reply!
I've seen that you mentioned MonoDevelop and Visual Studio, do I have to have installed either one of them in order to use rider properly?
EDIT:
If I open a Unity project like you sad the file indexing is disable, how to enable that?
You don't need MonoDevelop or VS installed to use Rider, no. It makes opening your first Unity project a little easier, because you can just open an existing Visual Studio .sln file and Rider does the rest. If you don't have them installed, you'll need to select Rider as the default external script editor in Unity's preferences (search for Rider in Program Files on Windows, or Applications for Mac), but once you've done that, you can just double click a C# file and it will open in Rider.
I'm not sure what's happened with the example you're giving. Make sure you open the solution by opening a .sln file, or double clicking a C# file. That should make sure the C# solution is correctly loaded. To make sure everything is properly loaded, open a C# script that contains a class that derives from MonoBehaviour. You should see little Unity icons in the editor "gutter" on the left hand side of the screen. These icons should highlight the class, any event functions and all serialised fields. Do you see this?
Here's how the Rider windows looks like:
I set the default program to open .cs by Editing its proprieties:
Then when I clicked on the .cs file on Unity Editor Rider asked my if I would liked to open just that file or the solution, I clicked the solution.
Thanks for the help
It looks like you've opened the project by opening the folder, and not the solution file. At Rider's welcome screen, click "Open Solution or Project" and navigate to the .sln file that lives in the project root.
Rider 2018.2 will improve this - if you try to open a folder that contains a solution, you'll be prompted to do the right thing, rather than get into this situation where it looks like you've opened the project but actually haven't.