dontdestroyonload unity
DontDestroyOnLoad(this.gameObject);using System.Collections;
using System.Collections.Generic;
using UnityEngine;// Object.DontDestroyOnLoad example.
//
// This script example manages the playing audio. The GameObject with the
// "music" tag is the BackgroundMusic GameObject. The AudioSource has the
// audio attached to the AudioClip.public class DontDestroy : MonoBehaviour
{
void Awake()
{
GameObject[] objs = GameObject.FindGameObjectsWithTag("music"); if (objs.Length > 1)
{
Destroy(this.gameObject);
} DontDestroyOnLoad(this.gameObject);
}
}
Also in C#:
- switch case c# contains
- make a list c#
- why is c# say ; expected
- c# get hwid
- how to reduce garbage collection c#
- unity rotate around point
- c# program exit
- c# function
- c# enum.getvalues
- wpf use enum description
- switch statement
- how to reference scripts in other scenes unity
- how to make a game
- parsing string to int without format exception c#
- change Backcolor c#
- serilog loglevel order
- c# clone stream
- how to change scenes in unity
- repeat 10 timesw c#
- convert array object to int[] c#
- unity how to change rotation
- unity cancel invokerepeating
- downlaod file and use C#
- string format comma c#