資源簡介
新版本的VRTK,解決了U3D資源商店2.3版本與Unity2018.1x版本不兼容的問題
代碼片段和文件信息
//=======?Copyright?(c)?Valve?Corporation?All?rights?reserved.?===============
//
//?Purpose:?Custom?inspector?display?for?SteamVR_Camera
//
//=============================================================================
using?UnityEngine;
using?UnityEditor;
using?System.IO;
[CustomEditor(typeof(SteamVR_Camera))?CanEditMultipleobjects]
public?class?SteamVR_Editor?:?Editor
{
int?bannerHeight?=?150;
Texture?logo;
SerializedProperty?script?wireframe;
string?GetResourcePath()
{
var?ms?=?Monoscript.Fromscriptableobject(this);
var?path?=?AssetDatabase.GetAssetPath(ms);
path?=?Path.GetDirectoryName(path);
return?path.Substring(0?path.Length?-?“Editor“.Length)?+?“Textures/“;
}
void?OnEnable()
{
var?resourcePath?=?GetResourcePath();
logo?=?AssetDatabase.LoadAssetAtPath(resourcePath?+?“l(fā)ogo.png“);
script?=?serializedobject.FindProperty(“m_script“);
wireframe?=?serializedobject.FindProperty(“wireframe“);
foreach?(SteamVR_Camera?target?in?targets)
target.ForceLast();
}
public?override?void?OnInspectorGUI()
{
serializedobject.Update();
var?rect?=?GUILayoutUtility.GetRect(Screen.width?-?38?bannerHeight?GUI.skin.box);
if?(logo)
GUI.DrawTexture(rect?logo?ScaleMode.ScaleToFit);
if?(!Application.isPlaying)
{
var?expand?=?false;
var?collapse?=?false;
foreach?(SteamVR_Camera?target?in?targets)
{
if?(AssetDatabase.Contains(target))
continue;
if?(target.isExpanded)
collapse?=?true;
else
expand?=?true;
}
if?(expand)
{
GUILayout.BeginHorizontal();
if?(GUILayout.Button(“Expand“))
{
foreach?(SteamVR_Camera?target?in?targets)
{
if?(AssetDatabase.Contains(target))
continue;
if?(!target.isExpanded)
{
target.Expand();
EditorUtility.SetDirty(target);
}
}
}
GUILayout.Space(18);
GUILayout.EndHorizontal();
}
if?(collapse)
{
GUILayout.BeginHorizontal();
if?(GUILayout.Button(“Collapse“))
{
foreach?(SteamVR_Camera?target?in?targets)
{
if?(AssetDatabase.Contains(target))
continue;
if?(target.isExpanded)
{
target.Collapse();
EditorUtility.SetDirty(target);
}
}
}
GUILayout.Space(18);
GUILayout.EndHorizontal();
}
}
EditorGUILayout.PropertyField(script);
EditorGUILayout.PropertyField(wireframe);
serializedobject.ApplyModifiedProperties();
}
public?static?void?ExportPackage()
{
AssetDatabase.ExportPackage(new?string[]?{
“Assets/SteamVR“
“Assets/Plugins/openvr_api.cs“
“Assets/Plugins/openvr_api.bundle“
“Assets/Plugins/x86/openvr_api.dll“
“Assets/Plugins/x86/steam_api.dll“
“Assets/Plugins/x86/libsteam_api.so“
“Assets/Plugins/x86_64/openvr_api.dll“
“Assets/Plugins/x86_64/steam_api.dll“
“Assets/Plugins/x86_64/libsteam_api.so
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-10-14?13:57??VRTK-master\
?????文件?????????181??2018-09-27?01:55??VRTK-master\.editorconfig
?????目錄???????????0??2018-10-14?13:32??VRTK-master\.github\
?????文件????????3469??2018-09-27?01:55??VRTK-master\.github\CODE_OF_CONDUCT.md
?????文件????????8720??2018-09-27?01:55??VRTK-master\.github\CONTRIBUTING.md
?????文件????????1219??2018-09-27?01:55??VRTK-master\.github\ISSUE_TEMPLATE.md
?????文件?????????190??2018-09-27?01:55??VRTK-master\.github\SUPPORT.md
?????文件????????1457??2018-09-27?01:55??VRTK-master\.gitignore
?????目錄???????????0??2018-10-14?13:50??VRTK-master\Assets\
?????目錄???????????0??2018-10-14?13:49??VRTK-master\Assets\SteamVR\
?????目錄???????????0??2018-10-14?13:49??VRTK-master\Assets\SteamVR\Editor\
?????文件????????3153??2018-01-11?02:24??VRTK-master\Assets\SteamVR\Editor\SteamVR_Editor.cs
?????文件?????????207??2018-01-11?02:24??VRTK-master\Assets\SteamVR\Editor\SteamVR_Editor.cs.me
?????文件????????1379??2018-01-11?02:23??VRTK-master\Assets\SteamVR\Editor\SteamVR_Preferences.cs
?????文件?????????276??2018-01-11?02:23??VRTK-master\Assets\SteamVR\Editor\SteamVR_Preferences.cs.me
?????文件????????3106??2018-01-11?02:24??VRTK-master\Assets\SteamVR\Editor\SteamVR_RenderModelEditor.cs
?????文件?????????276??2018-01-11?02:24??VRTK-master\Assets\SteamVR\Editor\SteamVR_RenderModelEditor.cs.me
?????文件???????23294??2018-01-11?02:26??VRTK-master\Assets\SteamVR\Editor\SteamVR_Settings.cs
?????文件?????????276??2018-01-11?02:26??VRTK-master\Assets\SteamVR\Editor\SteamVR_Settings.cs.me
?????文件???????13374??2018-01-11?02:25??VRTK-master\Assets\SteamVR\Editor\SteamVR_SkyboxEditor.cs
?????文件?????????276??2018-01-11?02:25??VRTK-master\Assets\SteamVR\Editor\SteamVR_SkyboxEditor.cs.me
?????文件????????4482??2018-01-11?02:25??VRTK-master\Assets\SteamVR\Editor\SteamVR_Update.cs
?????文件?????????276??2018-01-11?02:25??VRTK-master\Assets\SteamVR\Editor\SteamVR_Update.cs.me
?????文件?????????133??2018-01-11?02:26??VRTK-master\Assets\SteamVR\Editor.me
?????目錄???????????0??2018-10-14?13:49??VRTK-master\Assets\SteamVR\Extras\
?????文件????????2637??2018-01-11?02:24??VRTK-master\Assets\SteamVR\Extras\SteamVR_GazeTracker.cs
?????文件?????????276??2018-01-11?02:24??VRTK-master\Assets\SteamVR\Extras\SteamVR_GazeTracker.cs.me
?????文件????????4329??2018-01-11?02:26??VRTK-master\Assets\SteamVR\Extras\SteamVR_LaserPointer.cs
?????文件?????????276??2018-01-11?02:26??VRTK-master\Assets\SteamVR\Extras\SteamVR_LaserPointer.cs.me
?????文件????????3169??2018-01-11?02:23??VRTK-master\Assets\SteamVR\Extras\SteamVR_Teleporter.cs
?????文件?????????276??2018-01-11?02:23??VRTK-master\Assets\SteamVR\Extras\SteamVR_Teleporter.cs.me
............此處省略6204個文件信息
評論
共有 條評論