mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-13 22:09:53 -05:00
Merge pull request #1851 from ousttrue/fix/PathObject_if_UNITY_EDITOR
Editor向け機能の切り分け忘れ
This commit is contained in:
commit
ba197f68f5
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace VRMShaders
|
||||
{
|
||||
|
|
@ -119,25 +121,6 @@ namespace VRMShaders
|
|||
return UnityRoot.Child(src);
|
||||
}
|
||||
|
||||
public static bool TryGetFromAsset(UnityEngine.Object src, out PathObject dst)
|
||||
{
|
||||
if (src == null)
|
||||
{
|
||||
dst = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
var assetPath = AssetDatabase.GetAssetPath(src);
|
||||
if (string.IsNullOrEmpty(assetPath))
|
||||
{
|
||||
dst = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
dst = FromUnityAssetPath(assetPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool TryGetFromEnvironmentVariable(string key, out PathObject dst)
|
||||
{
|
||||
var value = System.Environment.GetEnvironmentVariable(key);
|
||||
|
|
@ -178,6 +161,26 @@ namespace VRMShaders
|
|||
File.WriteAllBytes(FullPath, data);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static bool TryGetFromAsset(UnityEngine.Object src, out PathObject dst)
|
||||
{
|
||||
if (src == null)
|
||||
{
|
||||
dst = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
var assetPath = AssetDatabase.GetAssetPath(src);
|
||||
if (string.IsNullOrEmpty(assetPath))
|
||||
{
|
||||
dst = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
dst = FromUnityAssetPath(assetPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void ImportAsset()
|
||||
{
|
||||
AssetDatabase.ImportAsset(UnityAssetPath);
|
||||
|
|
@ -198,5 +201,6 @@ namespace VRMShaders
|
|||
dst = PathObject.FromFullPath(path);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user