Search Results

Search found 3 results on 1 pages for 'london2423'.

Page 1/1 | 1 

  • Moving a Cube from a GUI texture on iOS [on hold]

    - by London2423
    I really hope someone can help me in this since I am working already two days but without any result. What I' am trying to achieve in this instance is to move a GameObject when a GUI Texture is touch on a Iphone. The GameObject to be moved is named Cube. The Cube has a Script named "Left" that supposedly when is "call it " from the GUITexture the Cube should move left. I hope is clear: I want to "activated" the script in the Game Object from the Guitexture. I try to use send message but without any joy as well so I am using GetComponent. This is the script "inside" the GUITexture using Unity and C# //script inside the gameobject cube so it can move left when call it from the GUItexture void Awake() { left = Cube.GetComponent<Left>().enable = true; } void Start() { Cube = GameObject.Find ("Cube"); } void Update () { //loop through all the touches on the screeen for(int i = 0 ; i < Input.touchCount; i++) { //execute this code for current touch (i) on the screen if(this.guiTexture.HitTest(Input.GetTouch(i).position)) { //if current hits our guiTecture, run this code if(Input.GetTouch (i).phase == TouchPhase.Began) //move the cube object Cube.GetComponent<Left> (); } if(Input.GetTouch (i).phase == TouchPhase.Ended) { return; } if(Input.GetTouch(i).phase == TouchPhase.Stationary); //if current finger is stationary run this code { Cube.GetComponent<Left> (); } } } } } This is the script inside the GameObject named "Cube" that is activated from the Gui Texture and when is activated from the GUITexture should allow the cube to move left public class Left : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void OnMousedown () { transform.position += Vector3.left * Time.deltaTime; } } Before write here I search all documentation, tutorial videos, forums but I still don't understand where is my mistake. May please someone help me Thanks CL

    Read the article

  • Shooter in iOS and a visible Aim line before shooting

    - by London2423
    I have to questions. I am trying to develop a game that is iOS but I did it first in my computer so I can tested there. I was able to must of it for PC but I am having a very hard time with iOS port The problem I do have is that I don't know how to shout in iOS. To be more specific how to line render in iOS This is the script I use in my computer using UnityEngine; using System.Collections; public class NewBehaviourScript : MonoBehaviour { LineRenderer line; void Start () { line = gameObject.GetComponent<LineRenderer>(); line.enabled = false; } void Update () { if (Input.GetButtonDown ("Fire1")) { StopCoroutine ("FireLaser"); StartCoroutine ("FireLaser"); } } IEnumerator FireLaser () { line.enabled = true; while (Input.GetButton("Fire1")) { Ray ray = new Ray(transform.position, transform.forward); RaycastHit hit; line.SetPosition (0, ray.origin); if (Physics.Raycast (ray, out hit,100)) { line.SetPosition(1,hit.point); if (hit.rigidbody) { hit.rigidbody.AddForceAtPosition(transform.forward * 5, hit.point); } } else line.SetPosition (1, ray.GetPoint (100)); yield return null; } line.enabled = false; { } } } Which part I have to change for iOS? I already did in the iOS the touch giu event so my player move around in the xcode/Iphone but I need some help with the shouting part. The second part of the question is where I do have to insert or change the script in order to first aim and I DO see the line of aim and then shout. Now the player can only shout. It can not aim at the gameobject, see the the line coming out of the gun aiming at the object and then shout? How I can do that. Everyone tell me Line render but that's what i did Thank you

    Read the article

  • two guitexture that do not work together

    - by London2423
    I have two GUITexture that move left and right a cube. Is pretty strange but together they don't work. If I activate only one it works. To be more specific: If I have the left GUItexture alone in the game the cube move left. If I have the right GUITexture activated alone the cube move right. Seems all fine I thought but If I have both of them the cube move only right and not left. Where is the mistake? Here is the code inside the GameObject cube for Right move void OnMousedown () { transform.position += Vector3.right * Time.deltaTime; } For Left move void OnMousedown () { transform.position += Vector3.left * Time.deltaTime; } And this is the left GUITexture code //move the cube left Cube.GetComponent<Left> ().enabled = true; left.transform.position += Vector3.left * Time.deltaTime; This is the right GUITexture //move the cube right Cube.GetComponent<Left> ().enabled = true; right.transform.position += Vector3.right * Time.deltaTime; What is the reason for this? I hope someone can help me.

    Read the article

1