What Remote Inspector is
This asset has a Remote Hierarchy window and a Remote Inspector window. They show you the states of your game running on a mobile device or a PC. And they allow you to change the fields and properties – both private and public!
Who needs this
In a large project, building an APK or an IPA takes many minutes to hours. So just adding a line of a log to your game (to print a variable’s value) can take most of your work time away. But if you build your game with this asset, you can do the following things without rebuilding your game or implementing a custom tool.
- Debugging – View the scene hierarchy and change game objects’ fields and properties without writing any code. Even private fields and properties.
- Performance Tuning – Turn on/off game objects and components to find what drops your game’s FPS down.
- Balancing – Tweak level data during playtests to make your game fun.
Just drop a prefab ‘RemoteInspectorServer’ in your first scene. The prefab has a small web server in it. And it communicates with the Unity Editor parts through the network.
If your PC and your mobile device are in the same network, just type the IP address of your mobile device and the port, and click the Refresh button in the Remote Hierarchy window. The default port is 8080. Or you can change the default port in the RemoteInspectorServer prefab.
Or, if your Android device is connected to your PC through a USB cable, you can make use of ADB’s port forwarding feature. The following command adds a port forwarding setting. If it is succeeded, type ‘localhost:8080’ and click the Refresh button in the Remote Hierarchy window. See Unity document’s ADB profiling section for details.
adb forward tcp:8080 tcp:8080
If you are using IL2CPP, you can not see some components in the Remote Inspector window. It is because IL2CPP strips unused classes by static checking. To prevent it, you need to set up a link.xml file in your Unity project. See Bytecode Stripping page for details.
Remote Inspector has an example link.xml file that preserves all UnityEngine core classes in the Example directory,
Example.link.xml. You need to rename it to
Remote Inspector shows components in a raw form. It’s different from Unity’s built-in inspector which makes use of custom editors. This may confuse you with unknown field and property names. But in some cases, this may help you with the ability to view and change raw values not exposed to Unity’s built-in inspector.
- Type or variable names not to serialize
- Add class types or variable names to SerializationConfig.IsSerializable()
Net Error:Cannot connect to the destination host
First, make sure your game is running with Remote Inspector enabled.Next, you need to check if you can connect to your mobile device from your PC. Type
http://[IP Address]:[Port] in the address bar of your web browser on the PC. Replace the
[IP Address] and
[Port] with the values you typed in the Remote Hierarchy window. If everything is OK, you can see the message
Welcome to Remote Inspector!.
If you are trying to connect your device through WIFI, make sure that your PC and your device are in the same network.
Or, you are trying to connect your Android device through USB/ADB, make sure of your ADB forwarding settings. type below in the command line.
adb forward --list
It will show you the current forward settings like below.
1515fa33f65c3282 tcp:8080 tcp:8080