Hi Guys, believe that i try to search but i couldn’t get right way.
Is this,
I have a object with name bt_UpArrow, with a GUI texture component, with this script:
public class GUI_Arrow_Up : MonoBehaviour {
public Cam_CTRL new_Cam_CTRL;
public static string ArrowKey_GLOBAL;
void OnMouseEnter()
{
new_Cam_CTRL = GameObject.Find ("Camera_CTRL").AddComponent<Cam_CTRL>();
ArrowKey_GLOBAL = "Up_Arrow";
}
void OnMouseExit()
{
Destroy(new_Cam_CTRL);
}
}
This, add a component with movement to the object Camera_CTRL, that have this script:
public class Cam_CTRL : MonoBehaviour {
public float turnSpeed = 50f;
public static string ArrowKey_GLOBAL;
private GUI_Arrow_Up new_GUI_Arrow_Up;
private string new_ArrowKey_GLOBAL;
void Awake()
{
// I NEED THIS ??? ///new_GUI_Arrow_Up = GetComponent<GUI_Arrow_Up>();
// PROBLEM // new_Message = GameObject.Find ("bt_UpArrow").GetComponent<GUI_Arrow_Up>().Mensagem;
}
void Update () {
if(ArrowKey_GLOBAL == "UpArrow")
{
transform.Rotate(Vector3.left, -turnSpeed * Time.deltaTime);
}
}
}
To place the component in the object to move, ok.
To transfer the string global and use as variable for different movements,i couldn’t.
can you help me thanks