This repository contains a Unity project that includes a custom CommandListener
script, which listens for TCP commands and executes corresponding methods within the Unity Editor. It also includes a utility for selecting assets in the Unity project.
-
Clone the repository:
git clone (https://github.com/veyselerCS/UnitySelect-Unity)
-
Copy the Editor folder:
- Copy the
Editor
folder to your Unity project'sAssets
directory.
- Copy the
-
Enable the Command Listener:
- In the Unity Editor, go to
Tools
>Command Listener
>Enable
.
- In the Unity Editor, go to
-
Create a static class with a static method:
public static class MyClass { public static void MyMethod(int number, string message) { Debug.Log($"Received number: {number}, message: {message}"); } }
-
Send a command to invoke the method:
- Use a TCP client to send the command in the format
ClassName.MethodName arg1 arg2 ...
. - Example command:
MyClass.MyMethod 123 "Hello Unity"
- Use a TCP client to send the command in the format
-
Check the Unity console for the output:
Received number: 123, message: Hello Unity
The package includes a utility script for selecting assets in the Unity project. To use this utility, call the SelectAssetInProject
method with the path to the asset you want to select:
SelectAsset.SelectAssetInProject("Assets/Path/To/Your/Asset");