For those who do not work with him using UnityEngine; using System.Collections; using UnityEngine.SceneManagement; public class changescan : MonoBehaviour { public GameObject guiObject; public string levelToLoad; // Use this for initialization void Start() { guiObject.SetActive(false); } // Update is called once per frame void OnTriggerStay(Collider other) { if (other.gameObject.tag == "Player") { guiObject.SetActive(true); if (guiObject.activeInHierarchy == true && Input.GetButtonDown("noww")) { SceneManager.LoadScene("2"); } } } void OnTriggerExit() { guiObject.SetActive(false); } }
@@mikethegamedev Thank you! The other iterations were refusing to detect OnTriggerExit so my canvas was still showing even when I moved out of the trigger zone
Bro, you da man. What is really funny is that im doing a ninja game based on naruto and i didnt even notice until after i clicked on the video. So for that, you gain a sub. Also you do a great job explaining things! Keep it up man
Lurony. Okay so if you are familiar with the Naruto series (which I assume you are) I have a question about making the tree jumping game mechanic. You know, how they swiftly jump from tree to tree to get to places really fast in the series? Well that's what I want to do. Do you mind if I message you on Skype with a few questions? Don't want to clutter up your YT inbox too much haha
github isn't showing the script. Here he is: using UnityEngine; using System.Collections; public class OnTriggerLoadLevel : MonoBehaviour { public GameObject guiObject; public string levelToLoad; //Use this for initialization void Start () { guiObject.SetActive(false); } //Update is called once per frame void OnTriggerStay (Collider other) { if (other.gameObject.tag == "Player") { guiObject.SetActive(true); if (guiObject.activeInHierarchy == true && Input.GetButtonDown("Use")) { Application.LoadLevel (levelToLoad); } } } void OnTriggerExit() { guiObject.SetActive(false); } }
using UnityEngine; using System.Collections; public class OnTriggerLoadLevel : MonoBehaviour { public GameObject guiObject; public string levelToLoad; // Use this for initialization void Start () { guiObject.SetActive(false); } // Update is called once per frame void OnTriggerStay (Collider other) { if(other.gameObject.tag == "Player") { guiObject.SetActive(true); if(guiObject.activeInHierarchy == true && Input.GetButtonDown("Use")) { Application.LoadLevel(levelToLoad); } } } void OnTriggerExit() { guiObject.SetActive(false); } }
Any chance you know how i would add a DontDestroyOnLoad to this script? i have tried multiple times and have had no luck with it i got a complex inv script i am using and keep losing all my items when i load to a different area
For those who do not work you can change there on 15th if (other.gameObject.name == "Player") if you dont tag your player (use your player name) :) ty for tutorial hf
hi, may i know how to make the cursor appear when the player trigger to 2d scene? my problem is when from my 3d scene load to 2 d scene the cursor is missing.. can u help me?
Can you make a video or explain how to go to certain spawn points in a scene depending on where you entered from. For example, if I enter the scene from a "room" that's on the left, how do I make them spawn on the left of the screen and not the right or middle?? Please
Hi, thanks for your tutorial. I have a problem: how to make the trigger associate with loading position? I mean, when changing scene, you simple use loadLevel API, and the player init position is pre-setted. what if there are two doors (A and B) to enter the new scene S, I enter S by door A, but want exit by door B, I don't know how to make the trigger take me to a certain place I set in another scene. do yo have any ideas? hope u could understand me... thanks again.
you could add a variable like an integer or something that you change to 1 if you went through door A, and to 2 if you went through door B. And once the scene is loaded, make a trigger which checks out the variable ( make it dontdestroyonload ) and depending on what it is, set your players transform.position to where you want them to be
HELP!! It says " Can't add script component 'Transition' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match" I tried everything went back to see if I made any mistakes and non plz help me
Your script name has to be the same in your project and in the script, make sure the names match at your assets and in your scripts before the : MonoDevelop
Four bigger if same wont to enter change the sean automatically just don't use input method thear not nessery as well use if (Input.GetKeyDown(KeyCode.E)) instead the input.button you use if i wont specific keyboard key
How would you have other text appear if a variable is true? As I though you could give more options upon entering a trigger if the player has done something?
Is there any way to keep the camera as it was when the character was outside the house? As in the original 3rd Person camera from behind him. Thank you for the amazing tutorial btw!!
Is it possible to make it so a door opens and the scene already loaded behind (like with no cutscene) it and when you walk in your in that scene and the door dissapears? wanting to know for a school project
The cartoony black outline and the colors are from a shader called TSF I think, just search the asset store for Cartoon Shader. The rest is from the models and the way they're textured. I got the map from here but I did modify it www.models-resource.com/ . If you're new I strongly recommend watching all of the newer videos I have and listening when I explain the coding, I answer some faq in most of these videos that aren't really explained anywhere else and try to explain everything in a way a newbie would understand. Hope you enjoy the videos!
how when I load the map to bring the letter before the tin door for example, if the above two doors each time to load the map loads of character out of the door correct door without having twice the same map?
If you want to know how to make a loading screen just load a scene in between the 2 scenes you want to switch. That scene serves as the loading screen, and then in that loading scene add a script that loads the next level after some time.
Yeah sure, easiest way to do this would be switching to the cinematic scene and just make a script that loads a new level after time, I think I have a video about that uploaded and just set the time duration to the cinematic duration, when it is done just switch to the new scene.
Can i use it to switch to character to another game (a mini game inside the game itself), how can i switch the controls as the game i would switch to will be a board game.
Yeah place the whole mini game into an empty prefab and just do SetActive(true), and disable the character components, once the mini game finishes just disable it and enable the character components.
I've a question. (Sorry for my english) I've done all the thing you have done, but it doesn't work. When i go into the cube, never happen and in console there's this error: UnassignedReferenceException: The variable guiObject of OnTriggerLoadLevel has not been assigned. But i've assigned the text at guiObject parameter, into the script in the cube Hope you can help me, thanks
If you copied the script from the video you might have copied it incorrectly, if you downloaded it from GitHub you didn't assign something. Go to the script and check if everything is in place, after that test out the game its a small error that is easy to fix, something is not assigned.
Onaa ouɐɟǝʇs dude!!! Please i am having the same problem...how do i change the tag to my player??? I am using fps controller that is buiot into unity!! Help me plssss
This was amazing! Though quick bonus question. Would you have any idea how to make the code spawn the player in a previous position in a scene? When I walk back out into the outside scene it spawns me to the original starting position instead of back at the door I just walked through. Thanks!
Look at the errors you're having I can't just guess what you did wrong, but its probably something to do with your UI and the Input Manager( you haven't set up the input for Use)
Is there a way to make it where if 2 versions of the player touch the area it will show the button, like if only one player touches the area it wont show up but if both of then touch the area it works, I am making a 2D platform game.
when i try it it says that the level cant be loaded because it has not been added to the build settings. But i did add it to the build settings. Any idea why this isnt working?
I have a tutorial on switching cameras (from first person to third person and vice versa) so you could watch that on my channel and another newer video I made about accessing other scripts. So you could access the camera script from the enter vehicle script and state that if you are in the vehicle the 3rd person camera is disabled and first person one enabled.
I said in the video, you have to create the Use input. Just click the plus icon, call the new input Use and set the positive button to e. It should work.
You could make 2 outdoor scenes that are exactly the same (just duplicate the one you made) and in the duplicate you just created make the player spawn in front of the house you want to enter. Then just make it so that the trigger that changes scenes inside the house changes to the new duplicate scene you made where the player is in front of the house. That's the simplest way and easiest for me to explain in a comment.
We made a tutorial on how to change scenes and end up in the right spot on our channel, and it works in the current LTS version of Unity. ruclips.net/video/U18j9t0XkaA/видео.html Hope this helps!
Dude, i have a problem, the real question is how can i make the text fade out, i mean, if i don't want to use the scene changing, the text will be there forever? D: i used it in a bathroom, the cube is in the shower and, with this i change to a shower scene with different camera, but if i don't want to take a shower? the text "press (e) to take a shower is still there, i need help
Let me explain better, when i go through the cube the text appears, if i decide not to use it and go anywhere in te house, the text remains there, i want to make it disappear when i just decide to move from there to another place, it is normal to happen? Cause in the video, your player didn't move after the Text "press (e)" was shown, what if you decided not to enter to the another scene?
You haven't tagged your player "Player" or you haven't written the script correctly, you have the script in the description on the GitHub page. The OnTriggerExit part where I set the guiObject to false takes care of the problem you're having.
the script isn't in the github page. Obviously i can just write it down off video but it takes a while. just please make sure ALL of the scripts are on the page.
If it's an UI element you can't, if it's a 3D plane with text or something there is a rotate function witch follows the position of a transform, you can use that search the unity API.
first of all, thank you for the tutorial. I followed along and got almost exactly what I was trying to do accomplished and this was very helpful. May I ask what it is that needs to be done so that my player can switch from the first scene to the second and retain all of its game object data? (such as components, current health and inventory, ect ect) thanks for your time.
We made a tutorial on how to change scenes and end up in the right spot on our channel, and any data on the player object will persist. ruclips.net/video/U18j9t0XkaA/видео.html Hope this helps!
i have this problem: UnassignedReferenceException: The variable horror of OntriggerLoadLevel has not been assigned. You probably need to assign the horror variable of the OntriggerLoadLevel script in the inspector. OntriggerLoadLevel.OnTriggerStay (UnityEngine.Collider other) (at Assets/OntriggerLoadLevel.cs:19)
If you're using 2D colliders just change the OnTriggerEnter to OnTriggerEnter2D and the Collider to a 2D one, check the Unity API for all of the 2D collision stuff.
either im stupid or im stupid. This is my code. ive done the edit>Project Settings>input>add use>positive E Made a GUI that says press e to enter, put the level in the build thing, added the script to a separate collider box where the door is and still nothing. using UnityEngine; using System.Collections; using UnityEngine.SceneManagement; public class OnTriggerLoadLevel : MonoBehaviour { public GameObject guiObject; public string LevelToLoad; // use this for initialization void Start () { guiObject.SetActive (false); } // Update is called once per fram void OnTriggerStay2D(Collider2D other) { if (other.gameObject.tag == "Player") { guiObject.SetActive (true); if (guiObject.activeInHierarchy == true && Input.GetButtonDown ("Use")) { SceneManager.LoadScene (LevelToLoad); } } } void OnTriggerExit2D() { guiObject.SetActive (false); } }
InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings. I get this
Next time please do a walkthrough from scratch please, instead of having all the scripting and world built and then explaining it, it would be much easier for beginners to understand imo
The video would take too long if I did everything on the spot from scratch, I write the script test it and then explain to you guys how I wrote it and what everything does and means.
Thanx lurony 4 yo great tutorials. But i seem 2 have a big problem in having the script run.(no code errors,and nothing happens when i try colliding with the door.not even the ui text shows up.)i followed your steps and watched the video like 12times(aint kidding bro (-_-) ).followed each step carefully but all in vain.Then i had a thought that hit me thinking could it be because am running unity 5.5.1 thats making something go wrong,or is it jst me thats not observing a micro step in the vid that i missed?I would really appreciate your help.and again thanks for the great tuts.
Actually i found the probs, I didn't tag player on collider.thanks man. But is there by any chance we could get the player to stand in the exact position of the door when we get out of the room? (And not at the strt point of the game).
i did as exactly as you said and it didn't work HELP using System.Collections; using System.Collections.Generic; using UnityEngine; public class loadScene : MonoBehaviour { public GameObject guiObject; public string levelToLoad; // Use this for initialization void Start () { guiObject.SetActive (false); } // Update is called once per frame void OnTriggerStay (Collider other) { if (other.gameObject.tag == "player") { guiObject.SetActive (true); if (guiObject.activeInHierarchy == true && Input.GetButtonDown ("Use")) { Application.LoadLevel (levelToLoad); } } } void OnTriggerExit() { guiObject.SetActive (false); } }
We made a tutorial on how to change scenes and end up in the right spot on our channel, and it works in the current LTS version of Unity. ruclips.net/video/U18j9t0XkaA/видео.html Hope this helps!
For those who do not work with him
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class changescan : MonoBehaviour
{
public GameObject guiObject;
public string levelToLoad;
// Use this for initialization
void Start()
{
guiObject.SetActive(false);
}
// Update is called once per frame
void OnTriggerStay(Collider other)
{
if (other.gameObject.tag == "Player")
{
guiObject.SetActive(true);
if (guiObject.activeInHierarchy == true && Input.GetButtonDown("noww"))
{
SceneManager.LoadScene("2");
}
}
}
void OnTriggerExit()
{
guiObject.SetActive(false);
}
}
thanks
there is the new script github.com/UnityTutorialsHD/Unity-Tutorial-Assets/blob/master/OnTriggerLoadLevelV2.cs
@@mikethegamedev Thank you! The other iterations were refusing to detect OnTriggerExit so my canvas was still showing even when I moved out of the trigger zone
you know you found the right tutorial when it is about naruto
10/10 - ign
"...would throw a ninja star again."
Franz Lomibao I love narito
i love nurito
I love norito
Damn that Naruto game looks dope. Even if it's a demo for testing, God that's so nice.
Whenever i find these tutorials, i know ill actually understand and get it.
How can I determine where my player spawns in the next scene?
it would just be where your camera is
We made a tutorial on how to change scenes and end up in the right spot on our channel.
ruclips.net/video/U18j9t0XkaA/видео.html
Hope this helps!
In GitHub , What Is The Script Name??!
@@positive2897 3 years later lmao
@@Nuff.x HHHAAHHAHAAHAHAHHAHAAHHAHHAAH
If he was final year student.. He already convo👨🎓😅
this of course github.com/UnityTutorialsHD/Unity-Tutorial-Assets/blob/master/OnTriggerLoadLevelV2.cs
You are my best unity teacher 🥰🥰🥰🥰🥰🥰🥰🥰
Bro, you da man. What is really funny is that im doing a ninja game based on naruto and i didnt even notice until after i clicked on the video. So for that, you gain a sub. Also you do a great job explaining things! Keep it up man
Thanks man, glad you enjoy my channel :)
Lurony. Okay so if you are familiar with the Naruto series (which I assume you are)
I have a question about making the tree jumping game mechanic. You know, how they swiftly jump from tree to tree to get to places really fast in the series? Well that's what I want to do. Do you mind if I message you on Skype with a few questions? Don't want to clutter up your YT inbox too much haha
Private message me on youtube
github isn't showing the script. Here he is:
using UnityEngine;
using System.Collections;
public class OnTriggerLoadLevel : MonoBehaviour {
public GameObject guiObject;
public string levelToLoad;
//Use this for initialization
void Start () {
guiObject.SetActive(false);
}
//Update is called once per frame
void OnTriggerStay (Collider other)
{
if (other.gameObject.tag == "Player")
{
guiObject.SetActive(true);
if (guiObject.activeInHierarchy == true && Input.GetButtonDown("Use"))
{
Application.LoadLevel (levelToLoad);
}
}
}
void OnTriggerExit()
{
guiObject.SetActive(false);
}
}
error CS1525: Unexpected symbol `void'
i think need to put scneManager
thanks for the help, yo. was really cool to hear more detail bout the script than other script tutorials. I hope your game goes well!
using UnityEngine;
using System.Collections;
public class OnTriggerLoadLevel : MonoBehaviour {
public GameObject guiObject;
public string levelToLoad;
// Use this for initialization
void Start () {
guiObject.SetActive(false);
}
// Update is called once per frame
void OnTriggerStay (Collider other)
{
if(other.gameObject.tag == "Player")
{
guiObject.SetActive(true);
if(guiObject.activeInHierarchy == true && Input.GetButtonDown("Use"))
{
Application.LoadLevel(levelToLoad);
}
}
}
void OnTriggerExit()
{
guiObject.SetActive(false);
}
}
Thank you so much, been looking for a tutorial like this for ages. Managed to apply this to my 2D game instead!
Plus, your game art looks awesome btw
I cannot find the script on GitHub... how is called?
you just saved me !! I have been looking all over on how to do this thank you so much !
No problem :)
Any chance you know how i would add a DontDestroyOnLoad to this script? i have tried multiple times and have had no luck with it i got a complex inv script i am using and keep losing all my items when i load to a different area
For those who do not work you can change there on 15th if (other.gameObject.name == "Player") if you dont tag your player (use your player name) :) ty for tutorial hf
It was very useful, thank you!! I already used it, it works fantastic.
Thank you for watching the video glad it helped you :)
hi, may i know how to make the cursor appear when the player trigger to 2d scene? my problem is when from my 3d scene load to 2 d scene the cursor is missing.. can u help me?
Can you make a video or explain how to go to certain spawn points in a scene depending on where you entered from. For example, if I enter the scene from a "room" that's on the left, how do I make them spawn on the left of the screen and not the right or middle??
Please
Hi, thanks for your tutorial. I have a problem: how to make the trigger associate with loading position? I mean, when changing scene, you simple use loadLevel API, and the player init position is pre-setted. what if there are two doors (A and B) to enter the new scene S, I enter S by door A, but want exit by door B, I don't know how to make the trigger take me to a certain place I set in another scene. do yo have any ideas? hope u could understand me... thanks again.
you could add a variable like an integer or something that you change to 1 if you went through door A, and to 2 if you went through door B. And once the scene is loaded, make a trigger which checks out the variable ( make it dontdestroyonload ) and depending on what it is, set your players transform.position to where you want them to be
HELP!! It says " Can't add script component 'Transition' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match" I tried everything went back to see if I made any mistakes and non plz help me
Your script name has to be the same in your project and in the script, make sure the names match at your assets and in your scripts before the : MonoDevelop
Lurony I figured it out what you didn't mention in the video is the object going into the trigger box you need to tag it as "player"
I had to "massage" the code to get it to work how I wanted it to (see: actual object instead of a GUI), but the base code was *beyond* helpful.
Thank you, I'm glad it helped :)
What shader are you using for the outlines on naruto?
omg thx so much i was dieing to know how to do cut sceans like that :D
"UnassignedReferenceException" The variable guiObject of OnTriggerLoadLevel has not been assigned. It has though.
you need to assign the scene nd in the build setting put all your scene
This was really helpful and right to the point. Thanks a bunch!
Four bigger if same wont to enter change the sean automatically just don't use input method thear not nessery as well use if (Input.GetKeyDown(KeyCode.E)) instead the input.button you use if i wont specific keyboard key
kinda weird how elementary this info is yet still beneficial to people.
How would you have other text appear if a variable is true? As I though you could give more options upon entering a trigger if the player has done something?
Make more GUI's and put them into an empty game object and set that to be the guiObject.
Is there any way to keep the camera as it was when the character was outside the house? As in the original 3rd Person camera from behind him. Thank you for the amazing tutorial btw!!
Is it possible to make it so a door opens and the scene already loaded behind (like with no cutscene) it and when you walk in your in that scene and the door dissapears? wanting to know for a school project
Anything is possible.
how would you save the camera permission when you go back to the previous scene?
sorry im new here.. i want to know how you make a nice map and graphic like that..?? is there any camera effect..??
The cartoony black outline and the colors are from a shader called TSF I think, just search the asset store for Cartoon Shader. The rest is from the models and the way they're textured. I got the map from here but I did modify it www.models-resource.com/ . If you're new I strongly recommend watching all of the newer videos I have and listening when I explain the coding, I answer some faq in most of these videos that aren't really explained anywhere else and try to explain everything in a way a newbie would understand. Hope you enjoy the videos!
ok.. so a map i made from blender and already textured can be added with TSF right.. sorry im newbie..
how when I load the map
to bring the letter before the tin door
for example, if the above two doors each time to load the map loads of character out of the door correct door without having twice the same map?
I'm sorry but I really don't understand what you wanted to ask try again.
ie to transfer the character outside of the
door after what loading
If you want to know how to make a loading screen just load a scene in between the 2 scenes you want to switch. That scene serves as the loading screen, and then in that loading scene add a script that loads the next level after some time.
but instead of just teleporting to next scene could i do a cinematic to next scene?
Yeah sure, easiest way to do this would be switching to the cinematic scene and just make a script that loads a new level after time, I think I have a video about that uploaded and just set the time duration to the cinematic duration, when it is done just switch to the new scene.
What's the song that played at the end of the video?? Plz
Can i use it to switch to character to another game (a mini game inside the game itself), how can i switch the controls as the game i would switch to will be a board game.
Yes of course, just make the mini game in a new scene and switch to that scene when entering the trigger.
Thanks for the reply mate. You've really good tutorials. Keep the good work going.
Is it possible that i place the mini map on to the screen and just switch the controls
Yeah place the whole mini game into an empty prefab and just do SetActive(true), and disable the character components, once the mini game finishes just disable it and enable the character components.
Could you make a tutorial on how you made the map and 3d models?
I've a question. (Sorry for my english)
I've done all the thing you have done, but it doesn't work.
When i go into the cube, never happen and in console there's this error:
UnassignedReferenceException: The variable guiObject of OnTriggerLoadLevel has not been assigned.
But i've assigned the text at guiObject parameter, into the script in the cube
Hope you can help me, thanks
If you copied the script from the video you might have copied it incorrectly, if you downloaded it from GitHub you didn't assign something. Go to the script and check if everything is in place, after that test out the game its a small error that is easy to fix, something is not assigned.
I've copied it correctly
But now it works
Before it didn't work because in the tag of the character there wasn't "player"
Thanks for all
No problem :)
Onaa ouɐɟǝʇs dude!!! Please i am having the same problem...how do i change the tag to my player??? I am using fps controller that is buiot into unity!! Help me plssss
This was amazing! Though quick bonus question. Would you have any idea how to make the code spawn the player in a previous position in a scene? When I walk back out into the outside scene it spawns me to the original starting position instead of back at the door I just walked through. Thanks!
We made a tutorial on how to change scenes and end up in the right spot on our channel.
ruclips.net/video/U18j9t0XkaA/видео.html
Hope this helps!
Guys, before commenting, watch the whole video, and download the script off github please.
The best way (that iv ever seen) to explain the code. You make it easy to understand.
Keep the good job
PD: Naruto stuff make it even better.
having issues when entering the collider the text isn't appearing nor does the scene change when pressing E.
Look at the errors you're having I can't just guess what you did wrong, but its probably something to do with your UI and the Input Manager( you haven't set up the input for Use)
Lurony got the issue sorted had to set the fps controller to player
How do you get the mouse icon to change when near objects or in trigger area?
Check the Cursor API on Unity's site.
You Really Helped me :) Gona stay tuned
What if you don't have a "use" section in Unity input in the project settings?
Click the plus icon, call it Use and set the positive button to whatever button you want it to be, hope this helps :)
Thank you :D
Is there a way to make it where if 2 versions of the player touch the area it will show the button, like if only one player touches the area it wont show up but if both of then touch the area it works, I am making a 2D platform game.
yes when you set that the collision must have a tag just write it like this
((other.gameobject.tag == "Player1") &&(other.gameobject == "Player2")
thanks for the asset bro.this really helps.
when i try it it says that the level cant be loaded because it has not been added to the build settings. But i did add it to the build settings. Any idea why this isnt working?
The level you're going from has to be in the build settings as well, it could be that or you misspelled the level name.
Lurony oh sorry I fixed it a while back just forgot to take down my comment lol the problem was that I spelled the level wrong
i have one error: Assets/Scripts/nextlevel.cs(8.10): error CS1519: Unexpected symbol public in class, struct, or interface member declaration
You copied the script incorrectly you're missing something or you misspelled something.
could i apply this to fighting games stage transitions too?
Great Video! Really helped thank you!
Hey, please make a tutorial on first person to car switching, that the first person is able to drive the car when a button I press a button
I have a tutorial on switching cameras (from first person to third person and vice versa) so you could watch that on my channel and another newer video I made about accessing other scripts. So you could access the camera script from the enter vehicle script and state that if you are in the vehicle the 3rd person camera is disabled and first person one enabled.
where can i get this beautiful asset from
Can you make a tutorial on how you set up the Kakashi model in the unity project?
Sure!
Thank a lot, your tutorials are awesome
Thanks man, glad you enjoy them :)
PLEASE Make a tutorial about rigging and placing into unity (Applying animations too)
I'll see what I can do
it doesnt show me the "USE" place in the InputManager what do i do?
Create one, call it Use and change the positive button to e
i'm new to unity so i don't know where to create one
thanks alot for the help got a sub :D
Thanks Bro!! You saved me
my game isnt like this i used it in this way but in input settings i dont see use and that might be why its not working for me
I said in the video, you have to create the Use input. Just click the plus icon, call the new input Use and set the positive button to e. It should work.
Lurony thx
How can I change the scenes without resetting my heath, thirst and hunger bars ???
Thank you. This helped me a lot
Can't find the script
You can copy it from the video, I've lost all of these previously done scripts because I've switched to a new project and got rid of the old assets.
Where i can get this level ? ) Tut is nice. But really cool is your level design
How can you make your game so that when you go back outdoors you spawn in front of the house and not somewhere else in the scene?
You could make 2 outdoor scenes that are exactly the same (just duplicate the one you made) and in the duplicate you just created make the player spawn in front of the house you want to enter. Then just make it so that the trigger that changes scenes inside the house changes to the new duplicate scene you made where the player is in front of the house. That's the simplest way and easiest for me to explain in a comment.
Ok ty ill try that
We made a tutorial on how to change scenes and end up in the right spot on our channel, and it works in the current LTS version of Unity.
ruclips.net/video/U18j9t0XkaA/видео.html
Hope this helps!
Dude, i have a problem, the real question is how can i make the text fade out, i mean, if i don't want to use the scene changing, the text will be there forever? D: i used it in a bathroom, the cube is in the shower and, with this i change to a shower scene with different camera, but if i don't want to take a shower? the text "press (e) to take a shower is still there, i need help
Let me explain better, when i go through the cube the text appears, if i decide not to use it and go anywhere in te house, the text remains there, i want to make it disappear when i just decide to move from there to another place, it is normal to happen? Cause in the video, your player didn't move after the Text "press (e)" was shown, what if you decided not to enter to the another scene?
You haven't tagged your player "Player" or you haven't written the script correctly, you have the script in the description on the GitHub page. The OnTriggerExit part where I set the guiObject to false takes care of the problem you're having.
Dude i wrote "OnTriggerxit" thanks a lot...
Bro, do you have videos of actual videogames you've made? i'm really interested on that, your tutorials ROCK!
I only have one I think, I should make more of those.
best tuts. thanks man.
the script isn't in the github page. Obviously i can just write it down off video but it takes a while. just please make sure ALL of the scripts are on the page.
Forgot to put it up, it isn't a long script tho you could just type it yourself you might learn a thing or two.
Lurony yeah i am trying to learn. hey just wanted to say your the best unity youtuber ive because of your art style its like mine its good.
How do you make sure the text always faces the player?
If it's an UI element you can't, if it's a 3D plane with text or something there is a rotate function witch follows the position of a transform, you can use that search the unity API.
would that be somethign like rotate text = unit vector of the camera position?
how did you get that Kakashi skin?
It's a 3d model not a skin www.models-resource.com/search/?q=Kakashi
github isn't showing the script its showing OnTriggerLoadLevelV2.cs which does not work
first of all, thank you for the tutorial. I followed along and got almost exactly what I was trying to do accomplished and this was very helpful. May I ask what it is that needs to be done so that my player can switch from the first scene to the second and retain all of its game object data? (such as components, current health and inventory, ect ect) thanks for your time.
It's a bit longer to write, I have my own way of doing this. Add me on skype xxkuhaxx (Uros K) and I'll help you.
thank you I will download skype now.
again, your time is appreciated.
We made a tutorial on how to change scenes and end up in the right spot on our channel, and any data on the player object will persist.
ruclips.net/video/U18j9t0XkaA/видео.html
Hope this helps!
haha, what was that song at the end?
Where can I get the Konoha Village and kakashi?
www.models-resource.com/
Thanks :)
Where did you get the Naruto models?
www.models-resource.com/ search for Naruto
thank you
i have this problem: UnassignedReferenceException: The variable horror of OntriggerLoadLevel has not been assigned.
You probably need to assign the horror variable of the OntriggerLoadLevel script in the inspector.
OntriggerLoadLevel.OnTriggerStay (UnityEngine.Collider other) (at Assets/OntriggerLoadLevel.cs:19)
imgur.com/a/yJg4l
imgur.com/a/77LWq
Does this work for a 2D game? Coz i cant seem to get it to work
If you're using 2D colliders just change the OnTriggerEnter to OnTriggerEnter2D and the Collider to a 2D one, check the Unity API for all of the 2D collision stuff.
either im stupid or im stupid. This is my code. ive done the edit>Project Settings>input>add use>positive E
Made a GUI that says press e to enter, put the level in the build thing, added the script to a separate collider box where the door is and still nothing.
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class OnTriggerLoadLevel : MonoBehaviour {
public GameObject guiObject;
public string LevelToLoad;
// use this for initialization
void Start () {
guiObject.SetActive (false);
}
// Update is called once per fram
void OnTriggerStay2D(Collider2D other)
{
if (other.gameObject.tag == "Player") {
guiObject.SetActive (true);
if (guiObject.activeInHierarchy == true && Input.GetButtonDown ("Use"))
{
SceneManager.LoadScene (LevelToLoad);
}
}
}
void OnTriggerExit2D()
{
guiObject.SetActive (false);
}
}
never mid my brother. i had to change other.gameobject.tag =="Player" to other.gameobject.name=="Player"
thank you for the tutorial!
InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings. I get this
in github what is the scripts name, its not there i believe
Yeah some scripts aren't there, just copy it from the video.
Great tutorial thanks!
how to public scene at script tab
Next time please do a walkthrough from scratch please, instead of having all the scripting and world built and then explaining it, it would be much easier for beginners to understand imo
The video would take too long if I did everything on the spot from scratch, I write the script test it and then explain to you guys how I wrote it and what everything does and means.
how to let the player with the same staff
Did you model these scenes yourself?
Bro you are the best thank you !
Thanx lurony 4 yo great tutorials. But i seem 2 have a big problem in having the script run.(no code errors,and nothing happens when i try colliding with the door.not even the ui text shows up.)i followed your steps and watched the video like 12times(aint kidding bro (-_-) ).followed each step carefully but all in vain.Then i had a thought that hit me thinking could it be because am running unity 5.5.1 thats making something go wrong,or is it jst me thats not observing a micro step in the vid that i missed?I would really appreciate your help.and again thanks for the great tuts.
Maybe you haven't set the collider to a trigger?
Actually i found the probs,
I didn't tag player on collider.thanks man.
But is there by any chance we could get the player to stand in the exact position of the door when we get out of the room? (And not at the strt point of the game).
431th subscriber! :D
Thanks :D
Lurony :)
Amazing tutorial!
ty for the video!@ pressed like and sub :)
Still work in v5.6
Thx bro ;)
Thanks a Lots... Working fine
Gracias hermano me funciono a la perfección :)
Good! thank you :)
one problem is that if you are low hp at the first scene, on the second one you will have full hp again
Yeah I made a video how you can fix that, ruclips.net/video/u5Y8QSBfH9c/видео.html
oh nice i just watched it and i really understood you, u got a new sub :) btw is that naruto game u working on or is it just for tutorial purposes?
Mostly tutorial purposes just wanted to make it pretty for everyone hahah
i did as exactly as you said and it didn't work HELP
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class loadScene : MonoBehaviour {
public GameObject guiObject;
public string levelToLoad;
// Use this for initialization
void Start () {
guiObject.SetActive (false);
}
// Update is called once per frame
void OnTriggerStay (Collider other)
{
if (other.gameObject.tag == "player")
{
guiObject.SetActive (true);
if (guiObject.activeInHierarchy == true && Input.GetButtonDown ("Use"))
{
Application.LoadLevel (levelToLoad);
}
}
}
void OnTriggerExit()
{
guiObject.SetActive (false);
}
}
i clicked cos I saw kakashi
Good Stuff, thanks
Can someone comment The script code Please
it doesn't work on 2019.3.11f1
We made a tutorial on how to change scenes and end up in the right spot on our channel, and it works in the current LTS version of Unity.
ruclips.net/video/U18j9t0XkaA/видео.html
Hope this helps!
Thanks dude ! ;)
Thank you!!