for ex, I hope use editor script to simulate actions:
Project > open “Assets/Editor” dir > select script file “MyScript.cs” > show MyScript.cs content in “Inspector”
how to do it?
for ex, I hope use editor script to simulate actions:
Project > open “Assets/Editor” dir > select script file “MyScript.cs” > show MyScript.cs content in “Inspector”
how to do it?
I find the solution
using UnityEditor;
using UnityEngine;
namespace Ro.Unity
{
public class TestOpenFile
{
[MenuItem("Test/Open File")]
public static void St()
{
var asset = AssetDatabase.LoadMainAssetAtPath("Assets/Editor/Test/TestOpenFile.cs");
Debug.Log($"asset:{asset}");
Selection.activeObject = asset;
}
}
}