“Unity No SerializeField” Réponses codées

Unity No SerializeField

[System.NonSerialized]
public int Num = 5;
Artyom Gabtraupov

Unity No SerializeField


[System.Serializable]
public class Item
{
    //Will be ignored by JsonUtility but will be visible in the Editor
    [SerializeField]
    private Transform _transform;
    [SerializeField]
    private float _value;

    [SerializeField]
    private Vector3 position;
    [SerializeField]
    private Quaternion rotation;
    [SerializeField]
    private Vector3 scale;

    //Call before serializing
    public void updateValues()
    {
        position = _transform.position;
        rotation = _transform.rotation;
        scale = _transform.localScale;
    }
}

Cruel Cat

Réponses similaires à “Unity No SerializeField”

Questions similaires à “Unity No SerializeField”

Plus de réponses similaires à “Unity No SerializeField” dans C#

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code