'Context menu and unity editor

i need to know of a method to use instead of "assetPreview.GetAssetPreview...because i only found out recently that assetpreview belongs to the function Unityeditor so i am not able to build my apk the error is Assets\Scripts\GameManager.cs(36,24): error CS0103: The name 'AssetPreview' does not exist in the current context

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class GameManager : MonoBehaviour
{
    public GameObject[] spaceshipPrefabs;
    public int[] spaceshipPrices = new int[] { 0, 5, 10, 15, 20, 25, 30, 35, 40 };
    public Texture2D[] spaceshipTextures;


    public static GameManager Instance;

    private int currentSpaceshipIdx = 0;
    public int CurrentSpaceshipIdx => currentSpaceshipIdx;


    public GameObject currentSpaceship => 
    `enter code here`spaceshipPrefabs[currentSpaceshipIdx];
    

    public int currentLevelIdx = 0;


    private void Awake()
    {
        if (Instance == null) 
        {
            Instance = this;
        }

        spaceshipTextures = new Texture2D[spaceshipPrefabs.Length];
        for(int i = 0; i < spaceshipPrefabs.Length; ++i)
        {
            GameObject prefab = spaceshipPrefabs [i];
            Texture2D texture = AssetPreview.GetAssetPreview (prefab);
            spaceshipTextures [i] = texture;
        }

        DontDestroyOnLoad(gameObject);

    }

    public void ChangeCurrentSpaceship(int idx)
    {

        currentSpaceshipIdx = idx;
    }
    


}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source