Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Why Unity Automatically Serialize Scripts?

Discussion in 'Scripting' started by muhammet12, Jan 2, 2021.

  1. muhammet12

    muhammet12

    Joined:
    Feb 29, 2020
    Posts:
    10
    Hi, sometimes I need to disable save-load system, but Unity automatically load last values and assign them to serializable variables. How can I disable it?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,749
    Almost no information to go on here, but perhaps look up the NonSerializable attribute, if that is your issue.
     
  3. muhammet12

    muhammet12

    Joined:
    Feb 29, 2020
    Posts:
    10
    I have a class like that:

    Code (CSharp):
    1. [System.Serializable]
    2. public class SaveData {
    3.     public int row;
    4.     public int  col;
    5. }
    I dont have any other code for save these values, but when I change them in game, Unity save them automatically.