# \[solved\] low level command parser variable return

**URL:** https://discussions.unity.com/t/solved-low-level-command-parser-variable-return/662880
**Category:** C# & .NET
**Tags:** Scripting
**Created:** [April 26, 2017, 10:26pm UTC](https://discussions.unity.com/t/solved-low-level-command-parser-variable-return/662880 "2017-04-26T22:26:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![XDSoftworks](https://avatars.discourse-cdn.com/v4/letter/x/c6cbf5/32.png) [@XDSoftworks](https://discussions.unity.com/u/XDSoftworks)
#### Post date: [April 26, 2017, 10:26pm UTC](https://discussions.unity.com/t/solved-low-level-command-parser-variable-return/662880/1 "2017-04-26T22:26:37Z")

</div>

hi, i was wondering if it is at all possible to return a variable’s existence via a string in a command window. i have a few ideas how to do it but whether they will work or not is the real question. my command window is simple and only assists players who want to develop maps in my game in the future or just build things in a kind of creative mode, it supports up to 8 arguments, i didn’t write any code yet. i was thinking something like this without [and].

at command window:  
/returnparam [varname]

at script level with a reference to the other script to have “scanned” for the variable type by name:  
using get property / get member search the referenced script for anything that matches and if found do something, if not found say that it doesn’t exist

or

at command window using the above at scrpt level:  
/returnparam [vartype] [varname]

i have looked at a few pages and they are all for java… i use c# and there is a lot of things java can do that c# can’t and c# looks to me like it is significantly faster than java so i stopped using java.

any help would be much appreciated.

thanks in advance.

---

<div class="post-metadata">

### Author: ![lordofduct](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/lordofduct/32/890751_2.png) [@lordofduct](https://discussions.unity.com/u/lordofduct)
#### Post date: [April 26, 2017, 11:31pm UTC](https://discussions.unity.com/t/solved-low-level-command-parser-variable-return/662880/2 "2017-04-26T23:31:23Z")

</div>

You want reflection…

System.Reflection:

> **[Reflection in .NET](https://learn.microsoft.com/en-us/dotnet/fundamentals/reflection/reflection?redirectedfrom=MSDN)**
>
> Review reflection in .NET. Get information about loaded assemblies and the types defined within them, such as classes, interfaces, structures, and enumerations.

You can get the type from an object with the ‘GetType’ method. Then with the Type object, you can call ‘GetMember’ to search for a member on the type by name.

> **[Reflection in .NET](https://learn.microsoft.com/en-us/dotnet/fundamentals/reflection/reflection?redirectedfrom=MSDN)**
>
> Review reflection in .NET. Get information about loaded assemblies and the types defined within them, such as classes, interfaces, structures, and enumerations.

---

<div class="post-metadata">

### Author: ![XDSoftworks](https://avatars.discourse-cdn.com/v4/letter/x/c6cbf5/32.png) [@XDSoftworks](https://discussions.unity.com/u/XDSoftworks)
#### Post date: [May 17, 2017, 2:33am UTC](https://discussions.unity.com/t/solved-low-level-command-parser-variable-return/662880/3 "2017-05-17T02:33:55Z")

</div>

> [@lordofduct](#):
>
> You want reflection…
> 
> System.Reflection:  
> [https://msdn.microsoft.com/en-us/library/f7ykdhsy(v=vs.110).aspx](https://msdn.microsoft.com/en-us/library/f7ykdhsy(v=vs.110).aspx)
> 
> You can get the type from an object with the ‘GetType’ method. Then with the Type object, you can call ‘GetMember’ to search for a member on the type by name.  
> [https://msdn.microsoft.com/en-us/library/f7ykdhsy(v=vs.110).aspx](https://msdn.microsoft.com/en-us/library/f7ykdhsy(v=vs.110).aspx)

hi, sorry for the long response time. i have a 14 hour work shift and work has been crazy lately, it just died down and now i can focus on my game again. this looks extremely useful and i will look into this on my time off. thanks for the reply 🙂

---

<div class="post-metadata">

### Author: ![XDSoftworks](https://avatars.discourse-cdn.com/v4/letter/x/c6cbf5/32.png) [@XDSoftworks](https://discussions.unity.com/u/XDSoftworks)
#### Post date: [September 27, 2017, 3:21pm UTC](https://discussions.unity.com/t/solved-low-level-command-parser-variable-return/662880/4 "2017-09-27T15:21:45Z")

</div>

> [@lordofduct](#):
>
> You want reflection…
> 
> System.Reflection:  
> [https://msdn.microsoft.com/en-us/library/f7ykdhsy(v=vs.110).aspx](https://msdn.microsoft.com/en-us/library/f7ykdhsy(v=vs.110).aspx)
> 
> You can get the type from an object with the ‘GetType’ method. Then with the Type object, you can call ‘GetMember’ to search for a member on the type by name.  
> [https://msdn.microsoft.com/en-us/library/f7ykdhsy(v=vs.110).aspx](https://msdn.microsoft.com/en-us/library/f7ykdhsy(v=vs.110).aspx)

hi again, i finally had some time to implement this and it works great, thanks for the reference.
