- Home /
overlap between scenes!!!
Hello
I have two scenes x and y, when i go from scene x to scene y in play mode some gameObjects move to scene y!!!!!! and when i switch between two scenes gameObjects still not removed.
gameObjects is Instantiated and RigidBody and its have some scripts, i am sure that the scrips not cause the problem and i don't use DontDestroyOnLoad() function on it. plz help.....THX
o_O I put script in parent gameObject for fps....and i forget it....Thx for everyone try to help me.
using UnityEngine;
using System.Collections;
public class FPSDisplayScript : $$anonymous$$onoBehaviour {
float timeA;
public int fps;
public int lastFPS;
public GUIStyle textStyle;
// Use this for initialization
void Start () {
timeA = Time.timeSinceLevelLoad;
DontDestroyOnLoad (this);
}
// Update is called once per frame
void Update () {
//Debug.Log(Time.timeSinceLevelLoad+" "+timeA);
if(Time.timeSinceLevelLoad - timeA <= 1)
{
fps++;
}
else
{
lastFPS = fps + 1;
timeA = Time.timeSinceLevelLoad;
fps = 0;
}
}
void OnGUI()
{
GUI.Label(new Rect( 450,5, 30,30),""+lastFPS,textStyle);
}
}
Answer by clunk47 · Jun 19, 2013 at 05:49 PM
You ARE using DontDestroyOnLoad in your Start function...
Your answer
Follow this Question
Related Questions
Destroy Object when scene loads 1 Answer
How to Get Gameobject position on screen resolution that not passed the resolution to set 0 Answers
DontDestroyOnLoad does not work after reload the scene? 1 Answer
How to mask gameObject by gameObject 4 Answers
How do I make gameObject stick in a corner of the screen like GUI 2 Answers