- Home /
command system with 3d gui interface
I just want to get on track with making an effective attack command system that sets a certain gameobject to be produced based on which move is assigned to which button. I also have included the 3d menu which does not use the the built in unity gui ( i personally find it a bit confusing and think that 3d menus and interfaces would look cooler anyway). So here is a quick draft of what I want to achieve that I emailed to myself via cellphone earlier today. Tell me what you think and give feed-back on whether or not this would be applicable. i would test it now but my computer basically died but I still want to continue progress with my idea as it is intended for a competition that is due in January. here is the code
var fire : gameobject;
var water: gameobject;
var rock: Rigidbody;
var move1: gameobject;
var move2: gameobject;
var move3: gameobject;
var menu: gameobject;
var movenum = 1;
functionUpdate(){
if(Input.GetButtonDown("Select"){
var 3dgl = gameobject.find("3dGUILocation");
instantiate(menu, 3dgl.transform, 3dgl.position);
function(movechoose);
}
if(Input.GetButtonDown("X")){
instantiate(move1, lp.transform.position, lp.transform.rotation);
}
if(Input.GetButtonDown("Y")){
instantiate(move2, lp.transform.position, lp.transform.rotation);
}
if(Input.GetButtonDown("B")){
instantiate(move3, lp.transform.position, lp.transform.rotation);
}
}
function(movechoose){
var fe = gameobject.find("fire emblem");
var we = gameobject.find("water emblem");
var re = gameobject.find("rock emblem");
if(GetAxis("Horizontal") >= 0.5){
movenum +=1;
if(movenum ==4){
movenum = 1;
}
}
if(GetAxis("Horizontal") <= -(0.5)){
movenum -=1;
if(movenum ==0){
movenum = 3;
}
}
if(movenum==1){
fe.animation.Play("jig");
print("do you want to select the fire attack?");
if(Input.GetButtonUp("A"){
fe.animation.Play("rumble");
print("which button do you want to assign it too?");
if(Input.GetButtonDown("X"){
move1 = fire;
}
if(Input.GetButtonDown("Y"){
move2 = fire;
}
if(Input.GetButtonDown("B"){
move3 = fire;
}
}
}
}
if(movenum==2){
we.animation.Play("jig");
print("do you want to select the water attack?");
if(Input.GetButtonUp("A"){
we.animation.Play("rumble");
print("which button do you want to assign it too?");
if(Input.GetButtonDown("X"){
move1 = water;
}
if(Input.GetButtonDown("Y"){
move2 = water;
}
if(Input.GetButtonDown("B"){
move3 = water;
}
}
}
if(movenum==3){
re.animation.Play("jig");
print("do you want to select the rock attack?");
if(Input.GetButtonUp("A"){
re.animation.Play("rumble");
print("which button do you want to assign it too?");
if(Input.GetButtonDown("X"){
move1 = water;
}
if(Input.GetButtonDown("Y"){
move2 = water;
}
if(Input.GetButtonDown("B"){
move3 = water;
}
}
}
}
}
you would really do better on the forum.
good luck with your project. if you have any specific technical woes, ask here! forum for discussion
Your answer
![](https://koobas.hobune.stream/wayback/20220613082938im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
UI system multiple ints as function arguments 4 Answers
Setting parent gives error? 2 Answers
Creating a level editor, question about GUI/interface 1 Answer
Resolution & aspect ratio GUI 1 Answer
EditorGUI and method create 0 Answers