Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

silasfriedrich

Member
  • Content Count

    37
  • Joined

  • Last visited

Everything posted by silasfriedrich

  1. Hi everyone , I have a script that should make a object with the tag Player the parent of the game object with the script on. Now the object with the tag Player is in a other scene, and that game object that should get the child of the Player have a script with a DontDestroyOnLoad function so it does not get deleted if the game loads the new scene. Now I tried it with it with this script: var bird : GameObject; function Start () { bird = GameObject.FindWithTag("Player"); bird.transform.parent = transform; } But this only works if the game object with the tag Player is in the same scene. Now I think it should work with something like this: var bird : GameObject; if (Application.LoadLevel) { bird = GameObject.FindWithTag("Player"); bird.transform.parent = transform; } But it doesnt work.
  2. I tried with: var bird = GameObject.FindWithTag("player"); function start () { bird.transform.parent = transform; } but its not working
  3. Hi everyone, I have a cube that have a script with a DontDestroyOnLoad function. Now if the new scene loadet i want to make the cube a child of a other game object. How can I do this? Thanks
  4. I did get it work. I made 3 void start and puted in the first one move in the other pinch and in the last rotation. Here is the finished script : using UnityEngine; using System.Collections; public class DemoOne : MonoBehaviour { public Transform cube; private Vector2 _scrollPosition; // for the scroll view void Start() { // turn on debug drawing while in the editor for assistance setting up your rects TouchKit.instance.debugDrawBoundaryFrames = true; var recognizer = new TKPanRecognizer(); // when using in conjunction with a pinch or rotation recognizer setting the min touches to 2 smoothes movement greatly if( Application.platform == RuntimePlatform.IPhonePlayer ) recognizer.minimumNumberOfTouches = 2; recognizer.gestureRecognizedEvent += ( r ) => { cube.transform.position -= new Vector3( recognizer.deltaTranslation.x, recognizer.deltaTranslation.y ) / -400; Debug.Log( "pan recognizer fired: " + r ); }; // continuous gestures have a complete event so that we know when they are done recognizing recognizer.gestureCompleteEvent += r => { Debug.Log( "pan gesture complete" ); }; TouchKit.addGestureRecognizer( recognizer ); start2 (); start3 (); } void start2 () { var recognizer = new TKPinchRecognizer(); recognizer.gestureRecognizedEvent += ( r ) => { cube.transform.localScale += Vector3.one * recognizer.deltaScale; Debug.Log( "pinch recognizer fired: " + r ); }; TouchKit.addGestureRecognizer( recognizer ); } void start3 () { var recognizer = new TKRotationRecognizer(); recognizer.gestureRecognizedEvent += ( r ) => { cube.Rotate( Vector3.back, recognizer.deltaRotation ); Debug.Log( "rotation recognizer fired: " + r ); }; TouchKit.addGestureRecognizer( recognizer ); } void OnGUI() { GUI.skin.button.padding = new RectOffset( 10, 10, 20, 20 ); GUI.skin.button.fixedWidth = 250; GUILayout.BeginArea( new Rect( Screen.width - GUI.skin.button.fixedWidth - 20, 0, GUI.skin.button.fixedWidth + 20, Screen.height ) ); _scrollPosition = GUILayout.BeginScrollView( _scrollPosition, GUILayout.Width( GUI.skin.button.fixedWidth + 20 ), GUILayout.Height( Screen.height ) ); GUILayout.EndScrollView(); GUILayout.EndArea(); } }
  5. Thanks Joey R . I always try to ask a question that way that it not sounds like: do this for me. It should say: can you helping me by this.
  6. Its not working Im getting a Parsing error and much unexpectet symbol errors.
  7. Thanks its working now I have an other question tough This script make GUI Buttons I have to press to activate the touch. But I want that I dont have to press the button. I tried use a void but its not working if( GUILayout.Button( "Add Pan Recognizer" ) ) { var recognizer = new TKPanRecognizer(); // when using in conjunction with a pinch or rotation recognizer setting the min touches to 2 smoothes movement greatly if( Application.platform == RuntimePlatform.IPhonePlayer ) recognizer.minimumNumberOfTouches = 2; recognizer.gestureRecognizedEvent += ( r ) => { cube.transform.position -= new Vector3( recognizer.deltaTranslation.x, recognizer.deltaTranslation.y ) / -200; Debug.Log( "pan recognizer fired: " + r ); }; // continuous gestures have a complete event so that we know when they are done recognizing recognizer.gestureCompleteEvent += r => { Debug.Log( "pan gesture complete" ); }; TouchKit.addGestureRecognizer( recognizer ); }
  8. And how can I make the cube stop if it enters the trigger. I tried using a rigidbody but the cube float away after the colision.
  9. Hi everyone, I have a scene where the player can move and rotate a cube by touch. So the player can touch anywhere one the screen and move the cube but I wanna make a collider where the cube can go through. What is the best way to do that?
  10. and how do i make the second cube move at the same place then the first ?
  11. Hi everyone, I need a little help by something that i cant get work. Im totally a beginner in scripting and unity and want to do a small android game. So i have a cube in a scene that can be moved and rotated by the touchscreen, now in a other scene I have the same cube and I want that if the cube in the first scene gets moved the other cube goes to the exact same lovation. I hope anyone can help me. thanks
×
×
  • Create New...