|
I want my player to destroy a cube when the down arrow key is pressed on a keyboard. I know I need to use the Destroy (Object); command but what would be the entire script?
(comments are locked)
|
I would tell you to look up what the value for the Arrow down key is, but since it appears to be down, the IDE will probably help you auto-complete it. I entered the script exactly as you've written it but it says there's an error. "Expecting }, got 'void'"
Aug 08 '12 at 01:02 PM
beefwellington
You're using C# script and not Java script correct?
Aug 08 '12 at 01:16 PM
ChadM
I'm using Javascript but when I created a C# script, I got a similar error message. If I wanted that script as a Javascript, what would it look like?
Aug 09 '12 at 04:22 AM
beefwellington2
if you use the code exactly as it is, it don't can work Replace (valueForArrowDownKey) with ("down"), here the input value http://docs.unity3d.com/Documentation/Manual/Input.html
Aug 09 '12 at 04:34 AM
Ingen
I tried that and got the same error: "Unexpected symbol: '{'" I get similar errors and seem to be having the same problem with Javascript and C#
Aug 09 '12 at 04:41 AM
beefwellington2
(comments are locked)
|
|
thats what i get for copying the above text class destroyObjectScript { void Update() { } } Missing a closing ) after input if(Input.GetKeyDown(KeyCode.DownArrow))
Aug 09 '12 at 07:22 AM
fafase
(comments are locked)
|
