Quantcast
Channel: Questions in topic: "dontdestroyonload"
Viewing all articles
Browse latest Browse all 416

Application.LoadLevel object clone spam

$
0
0
Hi, I tried DontDestroyOnLoad and Application.LoadLevel and the object is constantly created in the second level. Why is this? using UnityEngine; using System.Collections; public class BacktrackingTest : MonoBehaviour { public float float1 = 420; public float float2 = 9000; private bool LevelLoaded = false; void Start () { DontDestroyOnLoad(gameObject); //Data transfer between unity scenes test, does it subtract twice? float2 = float2 - float1; } void FixedUpdate () { if(Time.time>5 && LevelLoaded==false) { Application.LoadLevel(1); LevelLoaded=true; } } }

Viewing all articles
Browse latest Browse all 416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>