Resources folder items not in the build

Hi I made some images and audio-mixers in resources folder to use later. As in the title, after the build. My items not in the folder and some of my scripts are giving error, because of that. How can I fix this issue?

edit(moved from comment)

If someone wonders to look my code (Maybe code is messed. But so far works great and I’m focusing to implementing. After that I’ll do the cleanup )

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.EventSystems;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;

public class Main_Menu : MonoBehaviour
{
    internal GameObject[] _buttons, _texts, _sliders, _shutters;
    static TextMeshProUGUI _screentext;
    static int _sliderIndex;
    static GameObject[] _sound_sliders;
    internal TextMeshProUGUI _vsynctext, _graphicstext, _AA_result, _AA_sub_result;
    public List<GameObject> _graphicsbuttonslist, _vsyncbuttonslist, _AA_buttonslist, _AA_subbuttonslist;
    internal HDAdditionalCameraData _camera;
    Resolution[] _resolutions;
    public Dropdown _res_dropdown;
    AudioMixer[] _mixer;
    public GameObject[] _changer_buttons, _ReMappers;
    Slider _mouse_slider;
    Image _img;

    void Start()
    {
        _shutters = GameObject.FindGameObjectsWithTag("Shutters");
        #region Buttons Finder
        _AA_buttonslist.Insert(0, GameObject.Find("None"));
        _AA_buttonslist.Insert(1, GameObject.Find("Fxaa"));
        _AA_buttonslist.Insert(2, GameObject.Find("Taa"));
        _AA_buttonslist.Insert(3, GameObject.Find("Smaa"));

        _AA_subbuttonslist.Insert(0, GameObject.Find("AA_Low"));
        _AA_subbuttonslist.Insert(1, GameObject.Find("AA_Medium"));
        _AA_subbuttonslist.Insert(2, GameObject.Find("AA_High"));

        _graphicsbuttonslist.Insert(0, GameObject.Find("Low"));
        _graphicsbuttonslist.Insert(1, GameObject.Find("Medium"));
        _graphicsbuttonslist.Insert(2, GameObject.Find("High"));

        _vsyncbuttonslist.Insert(0, GameObject.Find("No_Limit"));
        _vsyncbuttonslist.Insert(1, GameObject.Find("60fps"));
        _vsyncbuttonslist.Insert(2, GameObject.Find("30fps"));
        #endregion

        _img = GameObject.Find("Background_Image").gameObject.GetComponent<Image>();
        _img.sprite = Resources.Load<Sprite>("apartment");

        _mixer = new AudioMixer[Universal_Properties._mixer_counter.Length];
        _mixer[0] = Resources.Load<AudioMixer>("Sounds/Ambient_Mixer");
        _mixer[1] = Resources.Load<AudioMixer>("Sounds/Effects_Mixer");
        _mixer[2] = Resources.Load<AudioMixer>("Sounds/Music_Mixer");
        _mixer[3] = Resources.Load<AudioMixer>("Sounds/Other_Mixer");
        _sliders = GameObject.FindGameObjectsWithTag("Slider_CSS");
        _changer_buttons = GameObject.FindGameObjectsWithTag("Changer_Buttons").OrderBy(go => go.name).ToArray();
        _ReMappers = GameObject.FindGameObjectsWithTag("ReMappers").OrderBy(go => go.name).ToArray();
        _sound_sliders = GameObject.FindGameObjectsWithTag("Slider").OrderBy(go => go.name).ToArray();
        _buttons = GameObject.FindGameObjectsWithTag("Main_Buttons");
        _texts = GameObject.FindGameObjectsWithTag("Main_Texts");
        _graphicstext = GameObject.Find("Graphics_Result").GetComponent<TextMeshProUGUI>();
        _vsynctext = GameObject.Find("Vsync_Result").GetComponent<TextMeshProUGUI>();
        _screentext = GameObject.Find("Screen_Result").GetComponent<TextMeshProUGUI>();
        _AA_result = GameObject.Find("AA_Result").GetComponent<TextMeshProUGUI>();
        _AA_sub_result = GameObject.Find("AA_Sub_Result").GetComponent<TextMeshProUGUI>();
        _camera = GameObject.Find("Main Camera").gameObject.GetComponent<HDAdditionalCameraData>();
        _mouse_slider = GameObject.Find("Mouse_Slider").gameObject.GetComponent<Slider>();
        _mouse_slider.value = Universal_Properties._mouse_speed;
      
        foreach (GameObject r in _buttons )
        {
            Image b = r.GetComponent<Image>();
            b.sprite = null;
            b.raycastTarget = Universal_Properties._raycasttarget;
            b.color = new Color32(188, 188, 188, 255);
        }
        foreach (GameObject r in _texts)
        {
            TextMeshProUGUI b = r.GetComponent<TextMeshProUGUI>();
            b.color = Color.white;
            b.alignment = TextAlignmentOptions.Center;
            b.fontSize = 23;
        }
        foreach (GameObject r in _sliders)
        {
            Image b = r.GetComponent<Image>();
            b.sprite = null;
        }
        switch (Universal_Properties._camera_AA)
        {
            case HDAdditionalCameraData.AntialiasingMode.None:
                {
                    _AA_result.text = _AA_buttonslist[0].GetComponentInChildren<TextMeshProUGUI>().text;
                    _camera.antialiasing = HDAdditionalCameraData.AntialiasingMode.None;
                    break;
                }
            case HDAdditionalCameraData.AntialiasingMode.FastApproximateAntialiasing:
                {
                    _AA_result.text = _AA_buttonslist[1].GetComponentInChildren<TextMeshProUGUI>().text;
                    _camera.antialiasing = HDAdditionalCameraData.AntialiasingMode.FastApproximateAntialiasing;
                    break;
                }
            case HDAdditionalCameraData.AntialiasingMode.TemporalAntialiasing:
                {
                    _AA_result.text = _AA_buttonslist[2].GetComponentInChildren<TextMeshProUGUI>().text;
                    _camera.antialiasing = HDAdditionalCameraData.AntialiasingMode.TemporalAntialiasing;

                    switch (Universal_Properties._TAA_Quality)
                    {
                        case HDAdditionalCameraData.TAAQualityLevel.Low:
                            {
                                _AA_sub_result.text = _AA_subbuttonslist[0].GetComponentInChildren<TextMeshProUGUI>().text;
                                _camera.antialiasing = (HDAdditionalCameraData.AntialiasingMode)HDAdditionalCameraData.TAAQualityLevel.Low;
                                break;
                            }
                        case HDAdditionalCameraData.TAAQualityLevel.Medium:
                            {
                                _AA_sub_result.text = _AA_subbuttonslist[1].GetComponentInChildren<TextMeshProUGUI>().text;
                                _camera.antialiasing = (HDAdditionalCameraData.AntialiasingMode)HDAdditionalCameraData.TAAQualityLevel.Medium;
                                break;
                            }
                        case HDAdditionalCameraData.TAAQualityLevel.High:
                            {
                                _AA_sub_result.text = _AA_subbuttonslist[2].GetComponentInChildren<TextMeshProUGUI>().text;
                                _camera.antialiasing = (HDAdditionalCameraData.AntialiasingMode)HDAdditionalCameraData.TAAQualityLevel.High;
                                break;
                            }
                    }
                    break;
                }
            case HDAdditionalCameraData.AntialiasingMode.SubpixelMorphologicalAntiAliasing:
                {
                    _AA_result.text = _AA_buttonslist[3].GetComponentInChildren<TextMeshProUGUI>().text;
                    _camera.antialiasing = HDAdditionalCameraData.AntialiasingMode.SubpixelMorphologicalAntiAliasing;

                    switch (Universal_Properties._SMAA_Quality)
                    {

                        case HDAdditionalCameraData.SMAAQualityLevel.Low:
                            {
                                _AA_sub_result.text = _AA_subbuttonslist[0].GetComponentInChildren<TextMeshProUGUI>().text;
                                _camera.antialiasing = (HDAdditionalCameraData.AntialiasingMode)HDAdditionalCameraData.SMAAQualityLevel.Low;
                                break;
                            }
                        case HDAdditionalCameraData.SMAAQualityLevel.Medium:
                            {
                                _AA_sub_result.text = _AA_subbuttonslist[1].GetComponentInChildren<TextMeshProUGUI>().text;
                                _camera.antialiasing = (HDAdditionalCameraData.AntialiasingMode)HDAdditionalCameraData.SMAAQualityLevel.Medium;
                                break;
                            }
                        case HDAdditionalCameraData.SMAAQualityLevel.High:
                            {
                                _AA_sub_result.text = _AA_subbuttonslist[2].GetComponentInChildren<TextMeshProUGUI>().text;
                                _camera.antialiasing = (HDAdditionalCameraData.AntialiasingMode)HDAdditionalCameraData.SMAAQualityLevel.High;
                                break;
                            }
                    }
                    break;
                }
        }
        switch(Universal_Properties._quality_level)
        {
            case 0:
                {
                    _graphicstext.text = _graphicsbuttonslist[0].GetComponentInChildren<TextMeshProUGUI>().text;
                    break;
                }
            case 1:
                {
                    _graphicstext.text = _graphicsbuttonslist[1].GetComponentInChildren<TextMeshProUGUI>().text;
                    break;
                }
            case 2:
                {
                    _graphicstext.text = _graphicsbuttonslist[2].GetComponentInChildren<TextMeshProUGUI>().text;
                    break;
                }
        }
        switch(Universal_Properties._vsync_lvl)
        {
            case 0:
                {
                    _vsynctext.text = _vsyncbuttonslist[0].gameObject.GetComponentInChildren<TextMeshProUGUI>().text;
                    break;
                }
            case 1:
                {
                    _vsynctext.text = _vsyncbuttonslist[1].gameObject.GetComponentInChildren<TextMeshProUGUI>().text;
                    break;
                }
            case 2:
                {
                    _vsynctext.text = _vsyncbuttonslist[2].gameObject.GetComponentInChildren<TextMeshProUGUI>().text;
                    break;
                }
        }
        
        for (int i = 0; i < _sound_sliders.Length; i++)
        {
            _sound_sliders*.gameObject.GetComponent<Slider>().onValueChanged.AddListener(delegate { SetVolume(); });*

}
for (int i = 0; i < _changer_buttons.Length; i++)
{
changer_buttons*.gameObject.GetComponent().onClick.AddListener(delegate { ReMapper(); });
Image b = _changer_buttons.GetComponent();*

b.sprite = null;
b.raycastTarget = Universal_Properties._raycasttarget;
b.color = new Color32(188, 188, 188, 255);
}
for (int i = 0; i < _ReMappers.Length; i++)
{_

}

#region Scrrencheck
if (Screen.fullScreen)
{
ScreenModeChecker(true);
}
else
{
ScreenModeChecker(false);
}
#endregion

StartCoroutine(Shutters());

#region Resolution listing
_resolutions = Screen.resolutions;
_res_dropdown.ClearOptions();
List options = new List();
int currenResolutionIndex = 0;
for (int i = 0; i < _resolutions.Length; i++)
{
if (resolutions*.refreshRate > 59)*
{
string option = resolutions.width + " x " + resolutions.height + " " + resolutions*.refreshRate + " Hz";*
options.Add(option);

}

if (resolutions.width == Screen.currentResolution.width && resolutions*.height == Screen.currentResolution.height)*
{

currenResolutionIndex = i;
}
}
_res_dropdown.AddOptions(options);
_res_dropdown.value = currenResolutionIndex;
_res_dropdown.RefreshShownValue();
#endregion //üstünde durulacak
}

private void ReMapper()
{

}

internal static void teller(GameObject obj)
{
for (int i = 0; i < _sound_sliders.Length; i++)
{
if (sound_sliders == obj)
{
_sliderIndex = i;
}
}
}_

internal static void ScreenModeChecker(bool chk)
{
if (chk == true)
_screentext.text = Universal_Properties._fullscreen;
else
_screentext.text = Universal_Properties._windowed;
}

public void AA_changer()
{
switch (EventSystem.current.currentSelectedGameObject.name)
{
case “None”:
{
_camera.antialiasing = HDAdditionalCameraData.AntialiasingMode.None;
break;
}
case “Fxaa”:
{
_camera.antialiasing = HDAdditionalCameraData.AntialiasingMode.FastApproximateAntialiasing;
break;
}
case “Taa”:
{
_camera.antialiasing = HDAdditionalCameraData.AntialiasingMode.TemporalAntialiasing;
break;
}
case “Smaa”:
{
_camera.antialiasing = HDAdditionalCameraData.AntialiasingMode.SubpixelMorphologicalAntiAliasing;
break;
}
}
_AA_result.text = EventSystem.current.currentSelectedGameObject.GetComponentInChildren().text;
Universal_Properties._camera_AA = _camera.antialiasing;
}

public void Sub_AA_changer()
{
if(Universal_Properties._camera_AA == HDAdditionalCameraData.AntialiasingMode.SubpixelMorphologicalAntiAliasing)
{
switch (EventSystem.current.currentSelectedGameObject.name)
{
case “AA_High”:
{
Universal_Properties._SMAA_Quality = HDAdditionalCameraData.SMAAQualityLevel.High;
break;
}
case “AA_Medium”:
{
Universal_Properties._SMAA_Quality = HDAdditionalCameraData.SMAAQualityLevel.Medium;
break;
}
case “AA_Low”:
{
Universal_Properties._SMAA_Quality = HDAdditionalCameraData.SMAAQualityLevel.Low;
break;
}
}
_AA_sub_result.text = EventSystem.current.currentSelectedGameObject.GetComponentInChildren().text;
_camera.SMAAQuality = Universal_Properties._SMAA_Quality;
}
else if (Universal_Properties._camera_AA == HDAdditionalCameraData.AntialiasingMode.TemporalAntialiasing)
{
switch (EventSystem.current.currentSelectedGameObject.name)
{

case “AA_High”:
{
Universal_Properties._TAA_Quality = HDAdditionalCameraData.TAAQualityLevel.High;
break;
}
case “AA_Medium”:
{
Universal_Properties._TAA_Quality = HDAdditionalCameraData.TAAQualityLevel.Medium;
break;
}
case “AA_Low”:
{
Universal_Properties._TAA_Quality = HDAdditionalCameraData.TAAQualityLevel.Low;
break;
}
}
_AA_sub_result.text = EventSystem.current.currentSelectedGameObject.GetComponentInChildren().text;
_camera.TAAQuality = Universal_Properties._TAA_Quality;
}
}

public void vsyncchanger()
{
switch (EventSystem.current.currentSelectedGameObject.name)
{
case “60fps”:
{
QualitySettings.vSyncCount = (int)vsync_lvl.Highfps;
break;
}
case “30fps”:
{
QualitySettings.vSyncCount = (int)vsync_lvl.Lowfps;
break;
}
case “No_Limit”:
{
QualitySettings.vSyncCount = (int)vsync_lvl.NoLimit;
break;
}
}
_vsynctext.text = EventSystem.current.currentSelectedGameObject.GetComponentInChildren().text;
Universal_Properties._vsync_lvl = QualitySettings.vSyncCount;
}

public void graphicspresent()
{
switch(EventSystem.current.currentSelectedGameObject.name)
{
case “High”:
{
QualitySettings.SetQualityLevel((int)present_lvl.High, true);
break;
}
case “Medium”:
{
QualitySettings.SetQualityLevel((int)present_lvl.Medium, true);
break;
}
case “Low”:
{
QualitySettings.SetQualityLevel((int)present_lvl.Low, true);
break;
}
}
Universal_Properties._quality_level = QualitySettings.GetQualityLevel();
_graphicstext.text = EventSystem.current.currentSelectedGameObject.GetComponentInChildren().text;
}

public void Screenmode_changer()
{
if(Screen.fullScreenMode == FullScreenMode.FullScreenWindow)
{
Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, FullScreenMode.Windowed); //Çözünürlükler ayarlanacak
_screentext.text = Universal_Properties._windowed;
}
else
{
Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, FullScreenMode.FullScreenWindow);
_screentext.text = Universal_Properties._fullscreen;
}
}

public void resolution(int Index)
{
Debug.Log(Index);

Resolution resolution = _resolutions[Index];
if (Screen.fullScreenMode == FullScreenMode.FullScreenWindow)
{ Screen.SetResolution(resolution.width, resolution.height, FullScreenMode.FullScreenWindow); }
else
{ Screen.SetResolution(resolution.width, resolution.height, FullScreenMode.Windowed); }
} //üstünde durulacak

public void SetVolume()
{
_mixer[_sliderIndex].SetFloat(Universal_Properties._fake_enums[_sliderIndex], Mathf.Log10(_sound_sliders[sliderIndex].gameObject.GetComponent().value) * Universal_Properties.volume_percentage);
}

IEnumerator Shutters()
{
yield return null;
foreach (GameObject r in _shutters)
{
r.SetActive(false);
}
}
}

not sure what is the problem in your case but turns out using Resources folder in unity is getting deprecated and you should use instead this method descrived here

https://docs.unity3d.com/Packages/com.unity.addressables@1.17/manual/index.html

better leave those resouces folder behind and learn this new method that appears to be better