You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using UnityEngine;
using NaughtyAttributes;
[CreateAssetMenu(fileName="New Naugty Item", menuName="Naugty Item", order=61)]
public class NaughtyScriptable : ScriptableObject
{
[Dropdown("_intValues")]
public int intDropdown;
private int[] _intValues = new int[] {10, 20};
[Dropdown("_stringValues")]
public string stringDropdown;
private string[] _stringValues = new string[] {"SILVER", "GOLD"};
}
Steps to repeat:
Drop the above code in your project.
Create a new scriptable asset by "Assets => Create => Naugty Item" (perhaps in your Resources folder).
Do not change any value and leave as is.
Load the created asset and display its values; intDropdown / stringDropdown
Expected result
intDropdown == 10 and stringDropdown == "SILVER" as it displays on the inspection menu when first created.
Actual result
intDropdown == 0 and stringDropdown == "" which are the default values of an int and string.
To have them set the first given values, you need to click to the dropdown in inspection and explicitly choose the first value that is visually no different then leaving it as it was. This is overall misleading and took me quite a few hours to understand where the problem is.
Thanks for the great library though, much appreciated.
The text was updated successfully, but these errors were encountered:
Steps to repeat:
Expected result
intDropdown == 10
andstringDropdown == "SILVER"
as it displays on the inspection menu when first created.Actual result
intDropdown == 0
andstringDropdown == ""
which are the default values of anint
andstring
.To have them set the first given values, you need to click to the dropdown in inspection and explicitly choose the first value that is visually no different then leaving it as it was. This is overall misleading and took me quite a few hours to understand where the problem is.
Thanks for the great library though, much appreciated.
The text was updated successfully, but these errors were encountered: