Search Results for

    Show / Hide Table of Contents

    Class BFlexComponent

    The absolute minimum possible set of shared behaviour between FlexItem and FlexContainer.

    (NB: FlexBuilder versions 0.1-2.0 had this class, but in reality the ideal is that they share ZERO code; v4 reinstated this for a very small number of features that really must be shared between them and shouldn't be accessed by external classes - because C# is so bad at permissions/privacy, this was the only way to give them a SHARED set of private internal methods and helper-classes)

    Inheritance
    Object
    BFlexComponent
    FlexContainer
    FlexItem
    Implements
    IFlexComponent,
    IUpgradeableComponent,
    Namespace: NinjaTools.FlexBuilder
    Assembly: cs.temp.dll.dll
    Syntax
    public abstract class BFlexComponent : UIBehaviour, IFlexComponent, IUpgradeableComponent

    Properties

    - (Boolean) _isContainerActiveAndEnabled

    NOTE: this it to workaround ENORMOUS bugs in core Unity, whereby Unity's GameObject.isActiveSelf / GameObject.isActiveInHierarchy return INCORRECT VALUES when entering playmode in the editor. But .enabled (at least in Unity-2020+) is ALSO incorrect, in a way that allows us to infer the TRUE value of the GameObject.

    Note: we are NEVER changing .enabled, it cannot change -- but Unity internally changes it while doing their callbacks! So we use that to 'detect' that they've disabled the object temporarilly)

    - (RootFlexContainer) containingRootFlexContainer

    Returns the innermost RootFlexContainer, i.e. the outermost part of this specific layout subtree, or null if this FlexContainer is not part of a rooted (i.e. valid/layouting) tree (which happens if e.g. this is a prefab of a partial layout).

    - (String) hierarchicalName

    Returns the fully-qualified name of this GameObject, by inserting the names of all its ancestors, separated by '.' - this makes it far easier to debug.

    - (String) hierarchicalNameCSV

    - (String) hierarchicalNameShortFirst

    As for hierarchicalName but for especially long/deep hierarchies this is more human-readable: it places the current GameObject's name first, then adds the ancestor information afterwards

    - (String) hierarchicalPath

    As for hierarchicalName except it separates elements by '/', making it suitable for cases where you want a 'path' style name

    - (FlexContainer) parentFlexContainer

    Checks if there's a parent object, and it has a FlexContainer (note: does NOT return this.FlexContainer, we want the parent, not self

    Use typically as: "if( OBJECT.parentFlexContainer is FlexContainer parentFC ) ... ".

    If you prefer, use: "if( OBJECT.HasParentConainer( out var parentFC ) ) ..." - these are effectively identical, but this method lets you on-the-fly also check '...and was it an RFC?'

    - (RectTransform) rectTransform

    - (Version) versionCreatedBy

    Which version of FlexBuilder originally created this component (mostly used for auto-upgrading and auto-fixing legacy bugs)

    - (Version) versionUpgradedTo

    Which version of FlexBuilder last upgraded this component (mostly used for auto-upgrading and auto-fixing legacy bugs)

    Methods

    - (Boolean) HasParentContainer(out FlexContainer)

    Infinitesimally more efficient version of parentFlexContainer

    Parameters
    FlexContainer parentFC
    Returns
    Boolean

    - (void) OnGloballingEnteringPlayMode()

    Unity's callback handler that we have to implement to fix major bugs in Unity's "RectTransform callbacks" system, which they now refuse to fix. Ignore it.

    - (void) OnGloballingLeavingPlayMode()

    Unity's callback handler that we have to implement to fix major bugs in Unity's "RectTransform callbacks" system, which they now refuse to fix. Ignore it.

    - (void) SetAnchorsToCenter(GameObject)

    Safe version of setting RectTransform anchoredPosition to "center" - this one suppresses the Unity callbacks that otherwise cause an infinite loop of re-positioning; always use this method instead of setting .anchoredPosition or .anchorMin or .anchorMax

    Also note the bug in core Unity: RectTransform.anchorMax / anchorMin have a never-documented side-effect of corrupting the RectTransform size, so you must ONLY call this immediately BEFORE setting Size (not after!)

    Parameters
    GameObject go

    - (void) SetPosition(GameObject, Vector2)

    Safe version of setting RectTransform.position - this one suppresses the Unity callbacks that otherwise cause an infinite loop of re-positioning; always use this method instead of setting .anchoredPosition

    Parameters
    GameObject go
    Vector2 newPosition

    - (void) SetSizeSuppressingLayout(GameObject, Vector2)

    Safe version of setting RectTransform.rect.size - this one suppresses the Unity callbacks that otherwise cause an infinite loop of re-positioning; always use this method instead of calling RectTransform.SetSizeWithCurrentAnchors

    Parameters
    GameObject go
    Vector2 newSize

    Implements

    IFlexComponent,
    IUpgradeableComponent,
    In This Article
    Back to top http://flexbuilder.ninja