|
Post by amazingcat on May 31, 2017 18:32:34 GMT
Hello, so basically when i change my scene with vloadlevel script to my menu scene player teleports aswell. What should I do to not make him teleport.
|
|
|
Post by Strider on Jul 12, 2017 0:59:48 GMT
I have the same problem, i'm linking my game with scenes using fungus, and it breaks the flow of the game as the character is falling to infinity.
thanks
|
|
|
Post by Strider on Jul 12, 2017 1:09:07 GMT
i see something interesting, when the game is running, the player, it's inventory system and Game Controller inmediately go to a folder that says "DontDestroyOnLoad"... that's why they keep moving throught scenes...
|
|
|
Post by uberwiggett on Jul 12, 2017 2:46:58 GMT
@ op: are you using a character in the start menu that is different to the one you want in the game? Or are you having troubles making that character teleport to the start location of your new scene? Strider; same as above, check out the template demo scene with the portal. You can actually define a spawn point, when the scene loads it will teleport your player there so you don't fall through the map. The player is put in the don'tdestroyonload command so that it retains all the changes to the inventory etc without having to work out a save system.
|
|
|
Post by Strider on Jul 12, 2017 5:08:39 GMT
@ op: are you using a character in the start menu that is different to the one you want in the game? Or are you having troubles making that character teleport to the start location of your new scene? Strider ; same as above, check out the template demo scene with the portal. You can actually define a spawn point, when the scene loads it will teleport your player there so you don't fall through the map. The player is put in the don'tdestroyonload command so that it retains all the changes to the inventory etc without having to work out a save system. i figured a way to don't bring the character to the new scene by comenting a couple of lines in vthirdpersoncontroller.cs, vGamecontroller and vinventory, and it works fine... the problem is i need fungus to link the scenes, and when the cutscenes starts, my character falls and the inventory system UI is still visible. Well, for now, is working fine.
|
|
|
Post by tharindu on Jul 12, 2017 13:42:53 GMT
I am working on my own load level scrips and it's pretty easy. Might be able to help you if you can give me the exact requirement . Try not to modify invector scripts. You don't know a change will come to bite you in the ass when an update comes.
|
|
|
Post by jrackley on Jul 12, 2017 13:56:30 GMT
I am working on my own load level scrips and it's pretty easy. Might be able to help you if you can give me the exact requirement . Try not to modify invector scripts. You don't know a change will come to bite you in the ass when an update comes. isn't that the truth! lol especially when you have a huge project.
|
|
|
Post by tharindu on Jul 12, 2017 14:11:43 GMT
I am working on my own load level scrips and it's pretty easy. Might be able to help you if you can give me the exact requirement . Try not to modify invector scripts. You don't know a change will come to bite you in the ass when an update comes. isn't that the truth! lol especially when you have a huge project. Tell me about it haha xD But I've managed to keep the addon relevant through two updates already with 0-10 lines of code changed. That's something I'd say lol
|
|
chuck
New vMember
Posts: 2
|
Post by chuck on Nov 18, 2017 22:42:19 GMT
Hey guys I have this issue too, I don't want that the invector character auto loads for the next scene! How do I fix this? INVECTOR creators some help pls?
|
|
|
Post by Alueckard on Oct 14, 2018 18:58:50 GMT
Hello, i solve this using spawnpoints (an empty object facing forward) in the exact start point in every scene, when you create a character this create a VGAMECONTROLLER so in this i specify the spawnpoint.This is requared in the VLOADLEVEL Script. You can put others spawnpoints as well to apear in other places, like go back from another door os something like that.
P.D: Sometimes if your spawnpoint is too far above the level , like a top of tower to the ground , may be affect the health of the character if you have the FALLDAMAGE script.
|
|
|
Post by narrenschlag on Oct 25, 2018 19:51:29 GMT
There is a easier way if you look how the vGameController script handles the death.
The problems all of you face is the fact that the games saves the gameobjects as
"DontDestroyOnReload". I wrote a script for my own game:
###############################################################################################
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
#if UNITY_5_3_OR_NEWER
using UnityEngine.SceneManagement;
#endif
namespace Invector
{
public class changeScene : MonoBehaviour
{
vGameController gm;
gameManagment manager;
private void Start()
{
gm = FindObjectOfType<vGameController>();
//use this for your own gameManager you use speratly. I use it for some extras outside of the Invector namespace.\\
// manager = FindObjectOfType<gameManagment>();
}
public void RestartLevel()
{
Destroy(gm.currentPlayer);
Destroy(manager.pauseMenu);
Destroy(manager.inventoryWindow);
Destroy(gm.gameObject);
Time.timeScale = 1;
#if UNITY_5_3_OR_NEWER
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
#else
Application.LoadLevel(Application.loadedLevel);
#endif
}
public void LoadMainMenu()
{
Destroy(GameObject.FindObjectOfType<vShooter.vShooterMeleeInput>().gameObject);
Destroy(gm.currentPlayer);
Destroy(manager.pauseMenu);
Destroy(manager.inventoryWindow);
Destroy(gm.gameObject);
Time.timeScale = 1;
#if UNITY_5_3_OR_NEWER
SceneManager.LoadScene(1);
#else
Application.LoadLevel(1);
#endif
}
public void LoadLevelOfIndex(int sceneIndex)
{
Destroy(gm.currentPlayer);
Destroy(manager.pauseMenu);
Destroy(gm.gameObject);
Time.timeScale = 1;
#if UNITY_5_3_OR_NEWER
SceneManager.LoadScene(sceneIndex);
#else
Application.LoadLevel(sceneIndex);
#endif
}
public void RestartLevelWithLoadingBar()
{
if(manager != null)
{
Destroy(manager.pauseMenu);
Destroy(manager.inventoryWindow);
}
if(gm != null)
{
Destroy(gm.currentPlayer);
Destroy(gm.gameObject);
}
Time.timeScale = 1;
#if UNITY_5_3_OR_NEWER
LoadingScreenManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
#else
LoadingScreenManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
#endif
}
public void LoadMainMenuWithLoadingBar()
{
//Destroy(GameObject.FindObjectOfType<vShooter.vShooterMeleeInput>().gameObject);
if(manager != null)
{
Destroy(manager.pauseMenu);
Destroy(manager.inventoryWindow);
}
if(gm != null)
{
Destroy(gm.currentPlayer);
Destroy(gm.gameObject);
}
Time.timeScale = 1;
#if UNITY_5_3_OR_NEWER
LoadingScreenManager.LoadScene(1);
#else
LoadingScreenManager.LoadScene(1);
#endif
}
public void LoadLevelOfIndexWithLoadingBar(int sceneIndex)
{
if(manager != null)
{
Destroy(manager.pauseMenu);
Destroy(manager.inventoryWindow);
}
if(gm != null)
{
Destroy(gm.currentPlayer);
Destroy(gm.gameObject);
}
Time.timeScale = 1;
#if UNITY_5_3_OR_NEWER
LoadingScreenManager.LoadScene(sceneIndex);
#else
LoadingScreenManager.LoadScene(sceneIndex);
#endif
}
}
}
########################################################
Error Fixes: Just delete the LoadingScreen functions and the gameManagment(manager) and all it's lines from the code. It's very important that every gameobject of Invector is deleted from the "DontDestroyOnReload".
|
|