-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Feature] Manage_graphics #890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9fdbd06
92df455
c1567f6
28a5454
1fd7a5c
2be9b42
f44f386
ccc84df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using System; | ||
| using MCPForUnity.Editor.Helpers; | ||
| using MCPForUnity.Editor.Tools.Graphics; | ||
| using Newtonsoft.Json.Linq; | ||
|
|
||
| namespace MCPForUnity.Editor.Resources.Scene | ||
| { | ||
| [McpForUnityResource("get_renderer_features")] | ||
| public static class RendererFeaturesResource | ||
| { | ||
| public static object HandleCommand(JObject @params) | ||
| { | ||
| try | ||
| { | ||
| return RendererFeatureOps.ListFeatures(@params ?? new JObject()); | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| McpLog.Error($"[RendererFeaturesResource] Error: {e}"); | ||
| return new ErrorResponse($"Error listing renderer features: {e.Message}"); | ||
| } | ||
| } | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using System; | ||
| using MCPForUnity.Editor.Helpers; | ||
| using MCPForUnity.Editor.Tools.Graphics; | ||
| using Newtonsoft.Json.Linq; | ||
|
|
||
| namespace MCPForUnity.Editor.Resources.Scene | ||
| { | ||
| [McpForUnityResource("get_rendering_stats")] | ||
| public static class RenderingStatsResource | ||
| { | ||
| public static object HandleCommand(JObject @params) | ||
| { | ||
| try | ||
| { | ||
| return RenderingStatsOps.GetStats(@params ?? new JObject()); | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| McpLog.Error($"[RenderingStatsResource] Error: {e}"); | ||
| return new ErrorResponse($"Error getting rendering stats: {e.Message}"); | ||
| } | ||
| } | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using System; | ||
| using MCPForUnity.Editor.Helpers; | ||
| using MCPForUnity.Editor.Tools.Graphics; | ||
| using Newtonsoft.Json.Linq; | ||
|
|
||
| namespace MCPForUnity.Editor.Resources.Scene | ||
| { | ||
| [McpForUnityResource("get_volumes")] | ||
| public static class VolumesResource | ||
| { | ||
| public static object HandleCommand(JObject @params) | ||
| { | ||
| try | ||
| { | ||
| return VolumeOps.ListVolumes(@params ?? new JObject()); | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| McpLog.Error($"[VolumesResource] Error listing volumes: {e}"); | ||
| return new ErrorResponse($"Error listing volumes: {e.Message}"); | ||
| } | ||
| } | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,15 +141,23 @@ internal static Component FindBrain() | |
| if (!HasCinemachine || _cmBrainType == null) | ||
| return null; | ||
|
|
||
| #if UNITY_2022_2_OR_NEWER | ||
| return UnityEngine.Object.FindFirstObjectByType(_cmBrainType) as Component; | ||
| #else | ||
| return UnityEngine.Object.FindObjectOfType(_cmBrainType) as Component; | ||
| #endif | ||
| } | ||
|
Comment on lines
+145
to
149
|
||
|
|
||
| internal static UnityEngine.Camera FindMainCamera() | ||
| { | ||
| var main = UnityEngine.Camera.main; | ||
| if (main != null) return main; | ||
|
|
||
| #if UNITY_2022_2_OR_NEWER | ||
| var allCams = UnityEngine.Object.FindObjectsByType<UnityEngine.Camera>(FindObjectsSortMode.None); | ||
| #else | ||
| var allCams = UnityEngine.Object.FindObjectsOfType<UnityEngine.Camera>(); | ||
| #endif | ||
| return allCams.Length > 0 ? allCams[0] : null; | ||
| } | ||
|
Comment on lines
+157
to
162
|
||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FindObjectsByType<T>(FindObjectsSortMode.None)is not available in Unity 2021.3, so this change will break compilation on the package's supported Unity version. UseFindObjectsOfType<T>()(or conditional compilation for newer Unity).