- Home /
Controlling the environment using XML/text
I would like to change properties of my unity environment (intensity of certain lights, position of an object, etc.) based on the output of a voice control module, which can output commands into a text file or XML file. For example, the line "Turn bedroom lamp on" would be added at the end of the output document, and this should then trigger the gameobject "bedroom lamp" to change intensity from 0 to 5.
As you may have deduced, I am not a programmer, I am in fact a User Experience researcher, working on a virtual prototype of a voice-controlled house for people with disabilities. We previously used buttons with attached scripts to control the environment, pressing them ourselves when a user gave a certain command, but now we need to test this with the actual voice recognizer.
Could anyone explain how this can be done in a simple manner? I'm only just starting to get into Unity and scripting, but we really would like to get this prototype working for doing user tests.
Answer by shaderop · Oct 10, 2012 at 05:53 PM
For starters, you can use a class called FileSystemWatcher to monitor the text or XML files for changes, and then you can read the files and extract the new commands when you get a change notification. It's pretty well documented so hopefully you shouldn't have much trouble using it in your own program.
Good luck.
Your answer
