- Home /
Question by
marinin2003 · Oct 29, 2018 at 08:15 PM ·
unity 2d
I have code related to adding audio.
Throws an error: Assets/Scripts/DontDestroy.cs(8,65): error CS1061: Type UnityEngine.GameObject[]' does not contain a definition for
Lenght' and no extension method Lenght' of type
UnityEngine.GameObject[]' could be found. Are you missing an assembly reference?
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class DontDestroy : MonoBehaviour {
void Start () {
if (GameObject.FindGameObjectsWithTag ("Audio").Lenght == 1)
DontDestroyOnLoad (gameObject);
else
Destroy (gameObject);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612181159im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to Detect a gameObject when Clicked near it? 2 Answers
Only sideways colliding detection 2 Answers
Second Coroutine isn't working Unity 1 Answer