- Home /
"Dont destroy on load" does not work at forst
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class debugPlanePrefabController : MonoBehaviour {
// Use this for initialization
void Start () {
DontDestroyOnLoad (this);
}
// Update is called once per frame
void Update () {
}
}
This script was working normally in Unity but I noticed that this script did not work on my phone(Debug). This gameobject destroyed. What code should I add? Or this problem is up to phone?
Try DontDestroyOnLoad (gameObject);
and make sure the gameobject is at the root of your hierarchy (no parent)
It did not destroy in Unity but this gameobject destroyed on my phone....
Well, it's hard to diagnose. Are you sure the object is not simply hidden ? $$anonymous$$aybe Logcat will help you?
I checked if this gameobject destroyed or not but this gameobject destroyed for sure on my phone only
Answer by Kiyoshi35 · Oct 20, 2017 at 11:37 AM
Actually Ii noticed that its related with plugin(ARKit) and I changed a code of ARKit a little then this gameObject did not destroy
Your answer
![](https://koobas.hobune.stream/wayback/20220612141057im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
why a gui image is rendered white on ios ? 0 Answers
Is this a good practice for mobile devices? 2 Answers
Device Token requirement in push notification 2 Answers
Unity iOS Build Bitcode Issue 1 Answer
GVR Audio Renderer not found iOS 0 Answers