Skip to main content
Glama

reflection-method-call

Call C# methods in Unity, including private ones, by providing method schemas and input parameters to execute functionality within the Unity Editor.

Instructions

Call C# method. Any method could be called, even private methods. It requires to receive proper method schema. Use 'reflection-method-find' to find available method before using it. Receives input parameters and returns result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterYesMethod filter. SCHEMA: {"namespace":"UnityEngine","typeName":"Application","methodName":"get_dataPath","inputParameters":[]}
knownNamespaceNoSet to true if 'Namespace' is known and full namespace name is specified in the 'filter.Namespace' property. Otherwise, set to false.false
typeNameMatchLevelNoMinimal match level for 'typeName'. 0 - ignore 'filter.typeName', 1 - contains ignoring case (default value), 2 - contains case sensitive, 3 - starts with ignoring case, 4 - starts with case sensitive, 5 - equals ignoring case, 6 - equals case sensitive.1
methodNameMatchLevelNoMinimal match level for 'MethodName'. 0 - ignore 'filter.MethodName', 1 - contains ignoring case (default value), 2 - contains case sensitive, 3 - starts with ignoring case, 4 - starts with case sensitive, 5 - equals ignoring case, 6 - equals case sensitive.1
parametersMatchLevelNoMinimal match level for 'Parameters'. 0 - ignore 'filter.Parameters', 1 - parameters count is the same, 2 - equals (default value).2
targetObjectNoSpecify target object to call method on. Should be null if the method is static or if there is no specific target instance. New instance of the specified class will be created if the method is instance method and the targetObject is null. Required: type - full type name of the object to call method on, value - serialized object value (it will be deserialized to the specified type). Schema: null for static methods, or {"instanceID":int}
inputParametersNoMethod input parameters. Per each parameter specify: type - full type name of the object to call method on, name - parameter name, value - serialized object value (it will be deserialized to the specified type). Schema: [{"typeName":"string","value":any}]
executeInMainThreadNoSet to true if the method should be executed in the main thread. Otherwise, set to false.true

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/butterlatte-zhang/unity-ai-bridge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server