Beispiel #1
0
        public void Unlink()
        {
            if (_entity == null)
            {
                throw new Exception("EntityLink is already unlinked!");
            }

            _entity.Release(this);
            _entity = null;
        }
        public static void DrawEntity(IEntityExt entity)
        {
            var bgColor = GUI.backgroundColor;

            GUI.backgroundColor = Color.red;
            if (GUILayout.Button("Destroy Entity"))
            {
                entity.Destroy();
            }

            GUI.backgroundColor = bgColor;

            DrawComponents(entity);

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Retained by (" + entity.retainCount + ")", EditorStyles.boldLabel);

            var safeAerc = entity.aerc as SafeAERC;

            if (safeAerc != null)
            {
                EditorLayout.BeginVerticalBox();
                {
                    foreach (var owner in safeAerc.owners.OrderBy(o => o.GetType().Name))
                    {
                        EditorGUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.LabelField(owner.ToString());
                            if (EditorLayout.MiniButton("Release"))
                            {
                                entity.Release(owner);
                            }

                            EditorGUILayout.EndHorizontal();
                        }
                    }
                }
                EditorLayout.EndVerticalBox();
            }
        }