created simple Scriptable object. and I wanted to create an asset from it. when i create it I cant access the properties of the the asset.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu]
public class Houe : ScriptableObject
{
public string Name { get; set; }
public int Price { get; set; }
public int bedrooms { get; set; }
public bool havePool { get; set; }
}
but when I created Villa asset i can’t access the public properties in the inspector and change them.
I’m not sure but I would just just variables instead of properties if you are having issues with them.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu]
public class Houe : ScriptableObject
{
[SerializeField] string name;
public string Name => name;
[SerializeField] int price;
public int Price => price;
[SerializeField] int bedrooms;
public int Bedrooms => bedrooms;
[SerializeField] bool havePool;
public bool HavePool => havePool;
}
or you can do it that way:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu]
public class Houe : ScriptableObject
{
[field: SerializeField]
public string Name { get; set; }
[field: SerializeField]
public int Price { get; set; }
[field: SerializeField]
public int bedrooms { get; set; }
[field: SerializeField]
public bool havePool { get; set; }
}