Answers for "unity rename populated list varibale"

C#
0

unity rename populated list varibale

//To rename a List or Variable in Unity without
// loosing the references/populated data:
using UnityEngine;
using UnityEngine.Serialization;

//Add "FormerlySerializedAs" with your current Variable name
[FormerlySerializedAs("myPreviousListName")]
public List<GameObject> myPreviousListName = new List<GameObject>();

//Save the script and switch to the inspector.

//Going back to your Script you can now insert your new name:

[FormerlySerializedAs("myPreviousListName")]
public List<GameObject> myNewListName = new List<GameObject>();

//Saving and switching to Inspector again and wait for the name to change

//(OPTIONAL) Remove "FormerlySerializedAs"

public List<GameObject> myNewListName = new List<GameObject>();
Posted by: Guest on January-10-2021

C# Answers by Framework

Browse Popular Code Answers by Language