diff --git a/Assets/Scenes/TestScene.unity b/Assets/Scenes/TestScene.unity index 918002f..4cb69c3 100644 --- a/Assets/Scenes/TestScene.unity +++ b/Assets/Scenes/TestScene.unity @@ -4267,7 +4267,7 @@ Transform: - {fileID: 1734890299} - {fileID: 529416814} m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &205498803 GameObject: @@ -5155,7 +5155,7 @@ Transform: - {fileID: 1533302259} - {fileID: 129354770} m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &529416811 GameObject: @@ -8623,7 +8623,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1618967478166023428, guid: e3d975a8d1b28eb4b9f646262c56653d, type: 3} propertyPath: m_RootOrder - value: 8 + value: 9 objectReference: {fileID: 0} - target: {fileID: 1618967478166023428, guid: e3d975a8d1b28eb4b9f646262c56653d, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -8739,6 +8739,49 @@ Light: m_UseBoundingSphereOverride: 0 m_ShadowRadius: 0 m_ShadowAngle: 0 +--- !u!1 &1002460576 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1002460577} + - component: {fileID: 1002460578} + m_Layer: 0 + m_Name: PhysicsSyncer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1002460577 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1002460576} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1002460578 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1002460576} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0f9e0806aba752c4aa853edd1ff03fda, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1022355506 GameObject: m_ObjectHideFlags: 0 @@ -9936,7 +9979,7 @@ Transform: - {fileID: 594137574} - {fileID: 1609014458} m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1104743577 GameObject: @@ -10496,7 +10539,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} --- !u!1 &1210745934 GameObject: @@ -12749,7 +12792,7 @@ Transform: - {fileID: 1870782421} - {fileID: 1220168323} m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1494157025 GameObject: @@ -17407,7 +17450,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1756963543 GameObject: @@ -18761,7 +18804,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3} propertyPath: m_RootOrder - value: 6 + value: 7 objectReference: {fileID: 0} - target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3} propertyPath: m_LocalEulerAnglesHint.x diff --git a/Assets/Scripts/Players/Player.cs b/Assets/Scripts/Players/Player.cs index 062ca01..de4f6f5 100644 --- a/Assets/Scripts/Players/Player.cs +++ b/Assets/Scripts/Players/Player.cs @@ -124,6 +124,9 @@ namespace NeonTea.Quakeball.Players { private void Awake() { CharacterController = GetComponent(); FeetPosition = transform.position + CharacterController.center - Vector3.up * (CharacterController.height / 2 + CharacterController.skinWidth / 2); + if (GameObject.FindObjectOfType() == null) { + Debug.LogWarning("Player.Awake: There is no PhysicsSyncer in this scene! Some code will not work as expected."); + } } private void Update() { diff --git a/Assets/Scripts/Util/PhysicsSyncer.cs b/Assets/Scripts/Util/PhysicsSyncer.cs new file mode 100644 index 0000000..ea12d22 --- /dev/null +++ b/Assets/Scripts/Util/PhysicsSyncer.cs @@ -0,0 +1,11 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace NeonTea.Quakeball.Util { + public class PhysicsSyncer : MonoBehaviour { + private void Update() { + Physics.SyncTransforms(); + } + } +} diff --git a/Assets/Scripts/Util/PhysicsSyncer.cs.meta b/Assets/Scripts/Util/PhysicsSyncer.cs.meta new file mode 100644 index 0000000..430a8cb --- /dev/null +++ b/Assets/Scripts/Util/PhysicsSyncer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0f9e0806aba752c4aa853edd1ff03fda +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 50 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: