Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Error "Unsupported type Vector2f" when editing Vector2 value in inspector #361

Open
rk-exxec opened this issue Jun 24, 2023 · 1 comment

Comments

@rk-exxec
Copy link

I have this code snippet in one of my scripts:

[Tooltip("Scale of the movement \"cells\", i.e. the larger the number, the smaller the movement waves.")]
[SerializeField] private Vector2 scale = new(0.002f, 0.002f);

Whenever I edit the values in the inspector, it shows the following error:

Unsupported type Vector2f
UnityEngine.StackTraceUtility:ExtractStackTrace ()
NaughtyAttributes.Editor.NaughtyInspector:DrawSerializedProperties () (at Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs:133)
NaughtyAttributes.Editor.NaughtyInspector:OnInspectorGUI () (at Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs:47)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Unsupported type Vector2f
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

I am using unity 2021.3.27f1, NaughtyAttributes 2.4.1 from the asset store.

Code context here, all the Vector2 attributes produce the error.

public class KelpShaderSettings : MonoBehaviour
{

    [Tooltip("Hue color to apply to all child sprite renderers. Used to uniformly color the whole plant.")]
    [ColorUsage(true)] [SerializeField] private Color hue = Color.white;

    [Tooltip("Speed of the wave movement, higher means faster.")]
    [NaughtyAttributes.InfoBox("Leaf Settings")] [SerializeField]
    private float speed = 1f;

    [Tooltip("Scale of the movement \"cells\", i.e. the larger the number, the smaller the movement waves.")]
    [SerializeField] private Vector2 scale = new(0.002f, 0.002f);
    
    [Tooltip("Strength of movement in every direction")]
    [SerializeField] private float strength = 0.5f;

    [Tooltip("This determines how sharp the movement is cutoff when closing on the leaf mount point. The lower, the smoother the cutoff. (Value determines exponent of the falloff function)")]
    [SerializeField] private float movementFalloff = 1f;

    [Tooltip("The magnitude of movement for the cardinal directions. x makes it move more left to right. y more up and down")]
    [SerializeField] private Vector2 direction = new(100f, 100f);
    
    [Tooltip("Time offset range. When updating leaf settings for each one a random number in this range is chosen and applied. This makes the leaves move more independent.")]
    [MinMaxSlider(-50, 50)] [SerializeField]
    private Vector2Int timeOffsetRange = new(-1, 1);

    [NaughtyAttributes.InfoBox("Stem Settings")] 
    [Tooltip("Speed of the stem movement. The higher, the faster.")]
    [SerializeField]
    private float stemSpeed = 1.3f;

    [Tooltip("Scale of the waves, lower means larger wave.")]
    [SerializeField] private Vector2 stemScale = new(0.002f,0.002f);
    
    [Tooltip("Magnitude of movement in all directions")]
    [SerializeField] private float stemStrength = 1.9f;
    
    [Tooltip("This determines how sharp the movement is cutoff when closing on the stem mount point, i.e. the bottom. The lower, the smoother the cutoff. (Value determines exponent of the falloff function)")]
    [SerializeField] private float stemMovementFalloff = 1f;
    
    [Tooltip("The magnitude of movement for the cardinal directions. x makes it move more left to right. y more up and down")]
    [SerializeField] private Vector2 stemDirection = new(100f, 10f);

    [Tooltip("The y coordinate of the stem mount point. Internally used to adjust the movement.")]
    [ReadOnly] [SerializeField] float stemYPosition = 0f;
   
    
    private List<SpriteRenderer> renderers;
    private Random rng;

    void Awake(){
    ...
@rk-exxec rk-exxec changed the title Error "Unsupported type Vector2f" when editing Vector2 value in inspector [Bug] Error "Unsupported type Vector2f" when editing Vector2 value in inspector Jun 24, 2023
@CareerDelTorro
Copy link

I came across the same error. In my case, I had to delete these lines from the .prefab:

vector2f_problem

Num is the name of my MinMaxSlider Vector2 variable here. After removing that entry, there were no more errors.

My setup had a base prefab and I had to delete the default MinMax value from it as well, not sure if it was related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants