kalmdown
kalmdown

Reputation: 641

Unity - How do I reset Inspector values for an ExecuteInEditMode script?

I want to get back to the default values without having to shutdown and restart Unity.

When I save in VSC the fields in the Inspector stay the same. The only way to get them to reset is to shutdown and restart Unity. Do I change code, a setting in Unity, or a setting in Visual Studio Code to get the Inspector panel and content back to original?

enter image description here

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[ExecuteInEditMode]
public class DebugGizmos : MonoBehaviour
{
 [SerializeField]
 private float innerRadius = 1.0f;

 [SerializeField]
 private float outerRadius = 10.0f;

 [SerializeField]
 private float angle = 10.0f;

 [SerializeField]
 private float gap = 10.0f;

 [SerializeField]
 private int segments = 10;

 [SerializeField]
 private float height = 1;

 // Debugging var for drawing Gizmos
 private Vector3 vLI, vLO, vUI, vUO;
 private List<Vector3> liaPts, loaPts, uiaPts, uoaPts;

 void OnDrawGizmos()
 {
     GenerateWedge(innerRadius, outerRadius, angle, gap, segments, height);
     // if (!Application.isPlaying) return;

     for (var i=0; i < segments; i++)
     {
         Gizmos.color = Color.red;
         Gizmos.DrawWireSphere(liaPts[i], .1f); //lowerInner
         Gizmos.color = Color.yellow;
         Gizmos.DrawWireSphere(uiaPts[i], .1f); //upperInner
         Gizmos.color = Color.green; 
         Gizmos.DrawWireSphere(loaPts[i], .1f); //lowerOuter
         Gizmos.color = Color.magenta;
         Gizmos.DrawWireSphere(uoaPts[i], .1f); //upperOuter
     }
 }

 ...and some helper functions.

Upvotes: 2

Views: 3126

Answers (1)

Jonathan Alfaro
Jonathan Alfaro

Reputation: 4376

Right Click on the Gear Icon in the Inspector where you script component is.

Then click on Reset.

That should make the values go back to their initial values.

Upvotes: 7

Related Questions