How to do key combinations?

I’m almost positive this should be right:

if((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)))
            {
                Debug.Log("Control...");
                if(Input.GetKeyDown(KeyCode.Alpha1))
                {
                    Debug.Log("Success.");
                    BuildAlphaList(KeyCode.Alpha1);
                }
}

Obviously the code is in update…

When I press either of the controls it prints “Control…” just fine… When I press ‘1’, though, it doesn’t register the key as being pressed… Am I doing something wrong here?

Just a guess… Is it the editor shortcuts that are messing this up?

Epictickle might be right. Your code worked for me.

Well, that’s just great lol… It definitely isn’t working for me. Gonna try it in a build and post the results.

Hahah I just now realized that “EpicTickle” was the original poster.

Yeah, upload your scene and I’ll see if it works on my end.

Oh, my scene is quite huge lol. I’ll try to post a tiny repro project soon. See, I’m building an RTS, and right now I can’t figure out how to build units correctly. It’s really annoying me lol.

Control + number is used in the editor for switching windows. control + 1 will switch to the scene view. Try another modiefer like shift

Did that. It worked perfectly. Thanks element… So, can I assume that it will work in build mode with the control buttons?

I’m on a mac, maybe that’s why it worked for me. CTRL 1 doesn’t seem to do anything in the editor.

Good luck on your RTS!

I actually made an RTS Style Drag Select package. Check it out:

Lmao. Believe it or not I’m already using it! I didn’t know you were the author… I was having trouble getting one to work for myself and came across your implementation and loved it! The only thing I had to implement was a Select() method in your interface. Other than that, it worked like a charm!!

haha, awesome!

For anyone interested, this is my projects barebones:

I borrowed all of my icons from the internet for the time being. You’ll notice some of the icons come straight from C&C. I do not plan on releasing them this way, they are just placeholders so I could see what building/unit I was actually building lol. Still a lot left to do, but here’s an overview of the features so far:

There are 5 different building types at the moment. Names have been ripped from C&C as well, but I do not plan on keeping them this way. Those buildings are:

Construction Yard - Main base, need this to build anything.
Barracks - Land Unit Creation.
Refinery - For gathering resources (currency).
Power Plant - Adds energy to your base.
War Factory - Land Vehicle Creation.

As for Units, there are currently only 3:
Soldier - Most basic land unit.
Tank - Most basic vehicle unit (will probably change).
Harvester - Harvests resources for you and takes them back to base.

Unit creation queue works flawlessly. Building creation does not queue, and I do not plan on adding a queue for them.

Bringing your energy level below 0 will turn all power off to your base and will render buildings useless until you bring your energy level to a positive number by building power plants.

As of right now, you are allowed to bring your currency to a negative balance. I have yet to implement anything to catch that. Will probably be the next thing I do.

You may group units into different groups by pressing SHIFT + 1-9 on your keyboard. A single unit is allowed to be a part of multiple groups.

that’s about it so far. Building creation and placement is all set on a grid in which the tile size is 5x5, and you may not overlap buildings when placing them. If you right-click before you place a building, it will give you your money back and delete the building. As of yet, you cannot pause or cancel building by right-clicking the build button, since Unity doesn’t have built-in support for right-clicking buttons I will have to either wait for them to support it (which could possibly be never), or I can extend the Button class myself and do it, which is probably what will end up happening.

Pretty much, I have the basics of an RTS on my hands… xP

Download:
http://www.filedropper.com/rts

PS: sorry for the external mirror. I’m having problems with my website host atm. Whenever they get my darn website back up I’ll give a better mirror.