i need a script that can load each level
after the win text is shown
or so
if there is a script that can load each time the win text is shown
i been trying to find videos on youtube and on google but it never seems to work
so can some one help me pls
if this scpit coz come out at each time the wintext it showen
is there a part of it i can add
pls help me
i am kind of a beginner on this
I already told you, all you need is to use :
Application.LoadLevel(NumberOfTheLevelInBuild)
U can, for exemple, put this on a button, like this :
function OnMouseDown(){
Application.LoadLevel(NumberOfTheLevelInBuild)
}
Remember that all your levels must be in your build, that you can acces through File/Build Settings.
Or u can use some “if” statements to trigger the loading of the level.
If you don’t undrstand how to use that, redo some basic tutorials, you need it, because EVERY GAME IS DIFFERENT, you’ll never find the exact script that you need and therefore need to understand the code you use and be able to make at least little modification to it.
i know
but i dont understand where to put the scpit in what part thats
why
and i am sorry for reposting the scrpit but wan i replay for u u dont replay back so thats why
i know i been trying to find lot of videos but it gets harder and harder each time
can u plss show me where i cud post the script ?
I’m sorry to sound harsh, but you don’t know programming, you barely know Unity, and you don’t seem to understand English well enough to be able to ask sensible questions and understand the provided answers. How do you expect to finish whatever it is you’re trying to do?
What’s your native language? I’m assuming from your forum name that it’s either Arabic, Farsi, or Urdu. Maybe if you tell us that someone would be able to point you to a local user group where help would be more accessible to you.
Where you have to put this line of code depend on your game. Maybe you have a score controller and want the game to end when you reach a certain score, let’s say 100 in this case, you would have to put in a script :
function Update(){
if(score >= 100){
Application.LoadLevel(NumberOfTheLevelInBuild)
}
}
But if you want the game to end with other condition, you have to change the if statement.
ok
this is the player script its C#
using UnityEngine;
using System.Collections;
public class BallScript : MonoBehaviour
{
public float speed;
public GUIText countText;
public GUIText wintext;
private int count;
void Start ()
{
count = 0;
SetCountText ();
wintext.text = "";
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce (movement * speed * Time.deltaTime);
}
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "PickUp")
{
other.gameObject.SetActive(false);
count = count + 1;
SetCountText ();
}
}
void SetCountText ()
{
countText.text = "Count: " + count.ToString();
if(count >= 12)
{
wintext.text = "YOU WIN";
}
}
}
where do i add the script in it or do i have to make a java one ?
[edit: Added code tags - Admin]
this is the levels one that i am trying to make it pop out at the end of each game
var boxbg : Texture2D;
var SceneOne : String;
var SceneOneName : String = "Level One";
var SceneTwo : String;
var SceneTwoName : String = "Level Two";
var SceneThree : String;
var SceneThreeName : String = "Level Three";
function OnGUI()
{
GUI.BeginGroup (Rect (Screen.width/2-50, Screen.height/2-50, Screen.width, Screen.height));
GUI.Box (Rect (0,0,150,200), boxbg);
if (GUI.Button(Rect(10,10,125,30),SceneOneName))
{
Application.LoadLevel(SceneOne);
}
if (GUI.Button(Rect(10,50,125,30),SceneTwoName))
{
Application.LoadLevel(SceneTwo);
}
if (GUI.Button(Rect(10,90,125,30),SceneThreeName))
{
Application.LoadLevel(SceneThree);
}
if (GUI.Button(Rect(10,130,125,30),"Quit"))
{
Application.Quit();
}
GUI.EndGroup();
}
this one is a java script
[edit: Added code tags - Admin]
sir there is ways of learning
there is learning by book and there is learning by experience
so i am learning both ways
and what ever is that i am doing is not of your worries sir your not going to play it
so dont be Quick to Judge on some things that u may not understand
Do you classify posting the same question over and over again as book learning or experience? Because I think most people would say it’s neither.
I’m not worried at all. Thank you for your concern though.
Irony!
Good luck, dude.
yes i do post the same question over and over and over again to maybe get a better reply
your welcome and i had no concerns
and good luck to u to sir
You are not at the correct level of Unity programming to be concerned with changing levels. Start with the basics first, because loading a level is quite trivial and if you do not know how to do that, there is probably a lot more you need to learn first.
yes i do know and i am going thru with basics
The basics include conditionals. If you understand conditionals then you would know where to load new levels from.
http://unity3d.com/learn/tutorials/modules/beginner/scripting
You NEED to watch all of those, because what you’re asking for is #5 on the list. That’s very, very basic coding. Don’t worry about multiple levels until you understand how to code one.
i do know what conditionals mean sir
and yes i am but in some points i dont understand what do they mean
You can start by:
A) using
tags around your code on forum so people can read it better
B) stop arguing with forum members. Just focus on the code :)
ok but i haven’t started it they did