void OnResponseReceived(BaseResponse response) { Repaint(); if (response is GetGameObjectResponse) { gameObjectResponse = (GetGameObjectResponse)response; } else if (response is InvokeMethodResponse) { InvokeMethodResponse invokeMethodResponse = (InvokeMethodResponse)response; methodOutput = invokeMethodResponse.MethodName + " () returned:\n" + invokeMethodResponse.ReturnedVariable.Value; UnityEngine.Object returnedUnityObject = invokeMethodResponse.ReturnedVariable.Value as UnityEngine.Object; if (returnedUnityObject != null) { EditorGUIUtility.PingObject(returnedUnityObject); } opacity = 1f; Repaint(); } else if (response is GetUnityObjectsResponse) { GetUnityObjectsResponse castResponse = (GetUnityObjectsResponse)response; RemoteObjectPickerWindow.Show(castResponse.Context, castResponse.ObjectDescriptions, castResponse.Variable, OnObjectPickerChanged); } #if SIDEKICK_DEBUG string responseString = ResponseDebug.GetDebugStringForResponse(response); if (!string.IsNullOrEmpty(responseString)) { Debug.Log(responseString); } #endif }
void OnResponseReceived(BaseResponse response) { Repaint(); if (response is GetGameObjectResponse) { gameObjectResponse = (GetGameObjectResponse)response; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(gameObjectResponse.GameObjectName); foreach (var component in gameObjectResponse.Components) { stringBuilder.Append(" "); stringBuilder.AppendLine(component.TypeFullName); foreach (var field in component.Fields) { stringBuilder.Append(" "); stringBuilder.Append(field.VariableName); stringBuilder.Append(" "); stringBuilder.Append(field.DataType); stringBuilder.Append(" = "); stringBuilder.Append(field.Value); stringBuilder.AppendLine(); } foreach (var property in component.Properties) { stringBuilder.Append(" "); stringBuilder.Append(property.VariableName); stringBuilder.Append(" "); stringBuilder.Append(property.DataType); stringBuilder.Append(" = "); stringBuilder.Append(property.Value); stringBuilder.AppendLine(); } foreach (var method in component.Methods) { stringBuilder.Append(" "); stringBuilder.Append(method.MethodName); stringBuilder.Append(" "); stringBuilder.Append(method.ReturnType); stringBuilder.Append(" "); stringBuilder.Append(method.ParameterCount); stringBuilder.Append(" "); if (method.Parameters.Count > 0) { stringBuilder.Append(method.Parameters[0].DataType); } stringBuilder.AppendLine(); } } //Debug.Log(stringBuilder); } else if (response is InvokeMethodResponse) { InvokeMethodResponse invokeMethodResponse = (InvokeMethodResponse)response; methodOutput = invokeMethodResponse.MethodName + " () returned:\n" + invokeMethodResponse.ReturnedVariable.Value; opacity = 1f; Repaint(); } else if (response is GetUnityObjectsResponse) { GetUnityObjectsResponse castResponse = (GetUnityObjectsResponse)response; RemoteObjectPickerWindow.Show(castResponse.ComponentGuid, castResponse.ObjectDescriptions, castResponse.Variable, OnObjectPickerChanged); } }