Ejemplo n.º 1
0
        private void OnValidate()
        {
            var col = GetComponent <Collider>();

            if (!col)
            {
                ManagedLog.LogError($"{Internal_GameObject.name} doesn't have any Collider component!", gameObject);
            }
            if (col && !col.isTrigger
                #region Editor
                && UnityEditor.EditorUtility.DisplayDialog("TriggerEvent", "TriggerEvent collider is not set as trigger, set it now?", "OK", "Cancel")
                #endregion
                )
            {
                col.isTrigger = true;
            }

            if (!_PhysicsObject)
            {
                _PhysicsObject = GetComponent <PhysicsObject>();
            }
            if (!_PhysicsObject)
            {
                _PhysicsObject = Internal_GameObject.AddComponent <PhysicsObject>();
            }
        }
Ejemplo n.º 2
0
        public void SetIsVisible(bool isVisible)
        {
            Internal_GameObject.SetActive(isVisible);

#if UNITY_EDITOR
            if (!Internal_GameObject.activeInHierarchy)
            {
                var firstDisabledParent = FindDisabledParent(Internal_Transform);
                ManagedLog.LogError($"{gameObject.GetScenePath()} will not be visible because one of it's parents ({firstDisabledParent.gameObject.GetScenePath()} is disabled. ");
            }
            Transform FindDisabledParent(Transform t)
            {
                while (true)
                {
                    if (!t.parent.gameObject.activeSelf)
                    {
                        return(t.parent);
                    }
                    if (t.parent == null)
                    {
                        return(null);
                    }
                    t = t.parent;
                }
            }
#endif
        }