public void OnAfterDeserialized(AnchorField anchorField) { Init(anchorField); //We load the link instances using link GUIDs LoadLinks(); }
//called only once (when the anchor is created) public void Initialize(AnchorField anchorField) { GUID = System.Guid.NewGuid().ToString(); Init(anchorField); //if we can have multiple anchors, we set the fieldIndex value if (anchorField.multiple) { fieldIndex = anchorField.anchors.Count; } }
void Init(AnchorField anchorField) { if (anchorField == null) { Debug.LogWarning("Null anchor field passed to Anchor at deserialization"); return; } anchorFieldRef = anchorField; color = anchorField.color; nodeRef = anchorField.nodeRef; visibility = anchorField.defaultVisibility; }
static void FindAnchors(AnchorField fromAnchorField, AnchorField toAnchorField, out Anchor fromAnchor, out Anchor toAnchor) { if (fromAnchorField.multiple) { fromAnchor = fromAnchorField.anchors.Find(a => a.linkCount == 0); } else { fromAnchor = fromAnchorField.anchors.First(); } if (toAnchorField.multiple) { toAnchor = toAnchorField.anchors.Find(a => a.linkCount == 0); } else { toAnchor = toAnchorField.anchors.First(); } }