Search Results

Search found 8 results on 1 pages for 'user3666251'.

Page 1/1 | 1 

  • Scripts won't affect clones - Unity3d

    - by user3666251
    I made a script which swaps two game objects on click.But the script won't work because the objects are actualy clones of the original prefab. This is the script (UnityScript): #pragma strict var object1 : GameObject; var object2 : GameObject; function OnMouseDown () { Instantiate(object2,object1.transform.position,object1.transform.rotation); Destroy(object1); } I use this script to create other game objects (clones)[c#] : using UnityEngine; using System.Collections; public class Spawner : MonoBehaviour { public GameObject[] obj; public float spawnMin = 1f; public float spawnMax = 2f; // Use this for initialization void Start () { Spawn (); } void Spawn() { Instantiate(obj[Random.Range(0, obj.GetLength(0))],transform.position, Quaternion.identity); Invoke ("Spawn", Random.Range (spawnMin, spawnMax)); } } The objects get renamed to NAME (Clone). What I wanna do is make the script affect clones too.So they will swap when I click on them.

    Read the article

  • Unity3D : Retry Menu (Scene Management)

    - by user3666251
    I'm making a simple 2D game for Android using the Unity3D game engine. I created all the levels and everything but I'm stuck at making the game over/retry menu. So far I've been using new scenes as a game over menu. I used this simple script: #pragma strict var level = Application.LoadLevel; function OnCollisionEnter(Collision : Collision) { if(Collision.collider.tag == "Player") { Application.LoadLevel("GameOver"); } } And this as a 'menu': #pragma strict var myGUISkin : GUISkin; var btnTexture : Texture; function OnGUI() { GUI.skin = myGUISkin; if (GUI.Button(Rect(Screen.width/2-60,Screen.height/2+30,100,40),"Retry")) Application.LoadLevel("Easy1"); if (GUI.Button(Rect(Screen.width/2-90,Screen.height/2+100,170,40),"Main Menu")) Application.LoadLevel("MainMenu"); } The problem stands at the part where I have to create over 200 game over scenes, obstacles (the objects that kill the player) and recreate the same script over 200 times for each level. Is there any other way to make this faster and less painful?

    Read the article

  • Unity3D Android : Game Over/Retry

    - by user3666251
    Im making a simple 2D game for android using the Unity3D game engine.I created all the levels and everything but Im stuck at making the game over/retry menu.So far I've been using new scenes as a game over menu.I used this simple script : pragma strict var level = Application.LoadLevel; function OnCollisionEnter(Collision : Collision) { if(Collision.collider.tag == "Player") { Application.LoadLevel("GameOver"); } } And this as a 'menu' : #pragma strict var myGUISkin : GUISkin; var btnTexture : Texture; function OnGUI() { GUI.skin = myGUISkin; if (GUI.Button(Rect(Screen.width/2-60,Screen.height/2+30,100,40),"Retry")) Application.LoadLevel("Easy1"); if (GUI.Button(Rect(Screen.width/2-90,Screen.height/2+100,170,40),"Main Menu")) Application.LoadLevel("MainMenu"); } The problem stands at the part where I have to create over 200 game over scenes,obscales(the objects that kill the player) and recreate the same script over 200 times for each level. Is there any other way to make this faster and less painful? I've been searching the web but didn't find anything useful according to my issue. Thank you.

    Read the article

  • Unity3D - Android pause screen - double click issue

    - by user3666251
    I made a pause script for the game im developing for android. I added the script to the GUITexture I created and placed on the top right side of the screen.The issue stands at the part where if the player clicks the pause button then clicks resume then he wants to pause the game again.When he clicks pause the second time the buttons dont show up unless he clicks again. This is the script : #pragma strict var paused = false; var isButtonVisible : boolean = true; function OnMouseDown(){ this.paused = !this.paused; Time.timeScale = 0; isButtonVisible = true; } function OnGUI(){ if ( isButtonVisible ) { if(this.paused){ if (GUI.Button(Rect(Screen.width/2-100,Screen.height/2+3,200,50),"Restart")){ Application.LoadLevel(Application.loadedLevel); Time.timeScale = 1; isButtonVisible = false; } if (GUI.Button(Rect(Screen.width/2-100,Screen.height/2-50,200,50),"Resume")){ Time.timeScale = 1; isButtonVisible = false; } // Insert the rest of the pause menu logic if (GUI.Button(Rect(Screen.width/2-100,Screen.height/2+56,200,50),"Main Menu")){ Application.LoadLevel ("MainMenu"); isButtonVisible = false; Time.timeScale = 1; } } } } Thank you.

    Read the article

  • Unity 3D - Error BCE0019 , " 'paused' is not a member of PauseScript"

    - by user3666251
    I am trying to make a game for Android in Unity. Came to the part where I have to make a pause menu option. Made a GUITexture and placed it on the top right side of the screen then I attached this script to it : #pragma strict function OnMouseDown(){ this.paused = !this.paused; } function OnGUI(){ if(this.paused){ if (GUI.Button(Rect(10,10,100,50),"Restart")){ Application.LoadLevel(Application.loadedLevel); } // Insert the rest of the pause menu logic } } It gives me this error : "Assets/Scripts/PauseScript.js(4,10): BCE0019: 'paused' is not a member of 'PauseScript'. " "PauseScript" is the name of my pause script. Thank you.

    Read the article

  • Unity3D Android - Move your character to a specific x position

    - by user3666251
    Im making a new game for android and I wanted to move my character (which is a cube for now) to a specific x location (on top of a flying floor/ground thingy) but I've been having some troubles with it.I've been using this script : var jumpSpeed: float = 3.5; var distToGround: float; function Start(){ // get the distance to ground distToGround = collider.bounds.extents.y; } function IsGrounded(): boolean { return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1); } function Update () { // Move the object to the right relative to the camera 1 unit/second. transform.Translate(Vector3.forward * Time.deltaTime); if (Input.anyKeyDown && IsGrounded()){ rigidbody.velocity.x = jumpSpeed; } } And this is the result (which is not what I want) : https://www.youtube.com/watch?v=Fj8B6eI4dbE&feature=youtu.be Anyone has any idea how to do this ? Im new in unity and scripting.Im using java btw. Ty.

    Read the article

  • Load previous (last) scene used in unity3d

    - by user3666251
    Im making a 2D game for android and I made over 200 levels/scenes.I also made a game over scene that opens when the players collides with an obscale.In the GameOver scene I added a retry button which I wanna make it so it opens the last level played.Im new in Unity and scripting.I've read other similar questions but none of them fixed my issue.Anyone has any idea that could help ? Im doing this because I don't wanna create over 200 game over scenes and edit each obscale in game. Thank you. Edit : Im using javascript.

    Read the article

  • Unity3D : Pause Menu - Android

    - by user3666251
    Im making a 2D game for android.I almost completed the game but now I need a pause game option.I added a pause icon on the top right side of the screen.The icon is a gui texture.Here is what I did so far : I made a script which will bring up some buttons (which is not working) and attached it to the GUITexture.This is the script : #pragma strict function OnMouseDown() { Debug.Log("*Pause Menu Opens*"); Time.timeScale = 0; if (GUI.Button(Rect(10,10,100,50),"Restart")); Application.LoadLevel(Application.loadedLevel); if (GUI.Button(Rect(10,60,100,50),"MainMenu")); Application.LoadLevel("MainMenu"); } Now,the problem stands at the part where the buttons won't show up,the game freezes at the first frame but the buttons won't show up.Please,if you can help I would be realy thankful. Thank you. Edit #1 : I just noticed that when I click "Pause" the game freezes and it takes me to the MainMenu.That's because I added the GUIButton which takes you to the main menu.I think the whole script structure is wrong.I also forgot to mention that Im new in scripting/unity. Thank you.

    Read the article

1