Question by
Crossway · Sep 21, 2019 at 12:56 PM ·
c#scripting problemeditoreditor-scripting
How to add wait for second for a Editor Script?
Hi. please take a look at below code. It's a code that update/Refresh Unity Editor but the problem is it uses a lot of CPU resources! So I'm looking for a way to make this script a bit lighter. Maybe something like wait for second but I have no idea how can I do this for a Editor script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
public class UpdateEditor : Editor
{
private float waitTime = 3f;
static UpdateEditor()
{
EditorApplication.update += Start;
}
static void Start()
{
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
}
}
Comment
Your answer
Follow this Question
Related Questions
Setting GameObject properties in editor when public script fields are changed 2 Answers
PostProcessingFactory.cs 2 Answers
How to Undo a lot of created objects at once? [Solved] 1 Answer
How to Have a ReoderableList in a Custom Editor Window 1 Answer
Array index out of range. But it doesn't appear to be. 2 Answers