playprefs with double Values

Can anyone tell me how to save double values? Unfortunately, it doesn’t work like that.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Shop : MonoBehaviour
{
    public GameObject OpenShop;
    public GameObject CloseShop;
    public GameObject Clickerr;

    public bool CreateJelly = false;
    public bool Pressed = false;

    public Text goldStats;

    public static int slimeToSpawn = 0;
    public Text[] GoldCostTexts;
    public double[] GoldValue;
    public double[] jellyAutoJelly;
    public double[] jellyAutoJellyIncreasePerSec;
    public GameObject[] jellies;


    void Start()
    {
        Vector3 randomSpawnPosition = new Vector3(Random.Range(-2.4f, 2.4f), Random.Range(1.8f, -2.6f));
        Instantiate(jellies[0], randomSpawnPosition, Quaternion.identity);
    }

    void Update()
    {
        goldStats.text = Clicker.goldCount.ToString();

        if (CreateJelly == false)
        {
            CreateJelly = true;
            StartCoroutine(JellyAutoJelly());
        }

        if (Pressed)
        {
            Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            transform.position = mousePos;
        }
    }

    IEnumerator JellyAutoJelly()
    {
        for (int jellyIndex = 0; jellyIndex < jellyAutoJelly.Length; jellyIndex++)
        {
            Slimes.jellyCount += jellyAutoJelly[jellyIndex];
        }
        yield return new WaitForSeconds(1);
        CreateJelly = false;
    }


    public void OpenShopOnClick()
    {
        OpenShop.SetActive(true);
        CloseShop.SetActive(true);
        Clickerr.SetActive(false);
    }

    public void CloseShopOnClick()
    {
        OpenShop.SetActive(false);
        CloseShop.SetActive(false);
        Clickerr.SetActive(true);
    }

    public void JellyPerSec(int jellyIndex)
    {
        if (slimeToSpawn <= 14 && Clicker.goldCount >= GoldValue[jellyIndex])
        {
            Debug.Log($"Spawn {jellies[jellyIndex].name}");

            Vector3 randomSpawnPosition = new Vector3(Random.Range(-2.4f, 2.4f), Random.Range(1.8f, -2.6f));

            Instantiate(jellies[jellyIndex], randomSpawnPosition, Quaternion.identity);

            Clicker.goldCount -= GoldValue[jellyIndex];
            GoldValue[jellyIndex] *= 1.3;
            jellyAutoJelly[jellyIndex] += jellyAutoJellyIncreasePerSec[jellyIndex];
            GoldCostTexts[jellyIndex].text = GoldValue[jellyIndex].ToString();
            slimeToSpawn++;
        }
    }

    private void SaveGame(int jellyIndex)
    {
        PlayerPrefs.SetInt("jellyAutoJellyIncreasePerSec", jellyAutoJellyIncreasePerSec[jellyIndex]);
    }
}

8232084--1075758--upload_2022-6-25_15-29-13.png

Us reading your mind is NOT A THING. You need to communicate properly.

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

This is the bare minimum of information to report:

  • what you want
  • what you tried
  • what you expected to happen
  • links to documentation you used to cross-check your work (CRITICAL!!!)
  • what actually happened, especially any errors you see

You may edit your post above.

Photographs of code are NOT A THING.

Unformatted code is also NOT A THING.

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: Using code tags properly