mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Removed NetworkTransformPreview because no one uses it and it had random errors (#60)
This commit is contained in:
parent
a2796c98c6
commit
3e751b3da5
@ -62,7 +62,6 @@
|
||||
<Compile Include="NetworkManagerPreview.cs" />
|
||||
<Compile Include="NetworkTransformChildEditor.cs" />
|
||||
<Compile Include="NetworkTransformEditor.cs" />
|
||||
<Compile Include="NetworkTransformPreview.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="NetworkManagerHUDEditor.cs" />
|
||||
<Compile Include="NetworkBehaviourInspector.cs" />
|
||||
|
@ -1,80 +0,0 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityObject = UnityEngine.Object;
|
||||
|
||||
namespace Mirror
|
||||
{
|
||||
[CustomPreview(typeof(GameObject))]
|
||||
class NetworkTransformPreview : ObjectPreview
|
||||
{
|
||||
NetworkTransform m_Transform;
|
||||
Rigidbody m_Rigidbody3D;
|
||||
Rigidbody2D m_Rigidbody2D;
|
||||
|
||||
GUIContent m_Title;
|
||||
|
||||
public override void Initialize(UnityObject[] targets)
|
||||
{
|
||||
base.Initialize(targets);
|
||||
GetNetworkInformation(target as GameObject);
|
||||
}
|
||||
|
||||
public override GUIContent GetPreviewTitle()
|
||||
{
|
||||
m_Title = m_Title ?? new GUIContent("Network Transform");
|
||||
return m_Title;
|
||||
}
|
||||
|
||||
public override bool HasPreviewGUI()
|
||||
{
|
||||
return m_Transform != null;
|
||||
}
|
||||
|
||||
public override void OnPreviewGUI(Rect r, GUIStyle background)
|
||||
{
|
||||
if (Event.current.type != EventType.Repaint)
|
||||
return;
|
||||
|
||||
if (m_Transform == null)
|
||||
return;
|
||||
|
||||
const int padding = 4;
|
||||
int posY = 4;
|
||||
|
||||
float posDiff = (m_Transform.transform.position - m_Transform.targetSyncPosition).magnitude;
|
||||
GUI.Label(new Rect(r.xMin + padding, r.y + posY, 600, 20), "Position: " + m_Transform.transform.position + " Target: " + m_Transform.targetSyncPosition + " Diff: " + posDiff);
|
||||
posY += 20;
|
||||
|
||||
if (m_Rigidbody3D != null)
|
||||
{
|
||||
float angleDiff3D = Quaternion.Angle(m_Transform.rigidbody3D.rotation, m_Transform.targetSyncRotation3D);
|
||||
GUI.Label(new Rect(r.xMin + padding, r.y + posY, 600, 20), "Angle: " + m_Transform.rigidbody3D.rotation + " Target: " + m_Transform.targetSyncRotation3D + " Diff: " + angleDiff3D);
|
||||
posY += 20;
|
||||
|
||||
GUI.Label(new Rect(r.xMin + padding, r.y + posY, 600, 20), "Velocity: " + m_Transform.rigidbody3D.velocity + " Target: " + m_Transform.targetSyncVelocity);
|
||||
posY += 20;
|
||||
}
|
||||
|
||||
if (m_Rigidbody2D != null)
|
||||
{
|
||||
float angleDiff2D = m_Transform.rigidbody2D.rotation - m_Transform.targetSyncRotation2D;
|
||||
GUI.Label(new Rect(r.xMin + padding, r.y + posY, 600, 20), "Angle: " + m_Transform.rigidbody2D.rotation + " Target: " + m_Transform.targetSyncRotation2D + " Diff: " + angleDiff2D);
|
||||
posY += 20;
|
||||
|
||||
GUI.Label(new Rect(r.xMin + padding, r.y + posY, 600, 20), "Velocity: " + m_Transform.rigidbody2D.velocity + " Target: " + m_Transform.targetSyncVelocity);
|
||||
posY += 20;
|
||||
}
|
||||
|
||||
GUI.Label(new Rect(r.xMin + padding, r.y + posY, 200, 20), "Last SyncTime: " + (Time.time - m_Transform.lastSyncTime));
|
||||
}
|
||||
|
||||
void GetNetworkInformation(GameObject gameObject)
|
||||
{
|
||||
m_Transform = gameObject.GetComponent<NetworkTransform>();
|
||||
|
||||
m_Rigidbody3D = gameObject.GetComponent<Rigidbody>();
|
||||
m_Rigidbody2D = gameObject.GetComponent<Rigidbody2D>();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user