Hide
FindObjectsByType/GetInScene

Automatically assign a component to a field, if the field value is null and the component is in the currently opened scene. (First one found will be used)

(Old Name: GetComponentInScene)

  • (Optional) EXP config: config. See Saints XPath-like Syntax section for more information.

    Note: You can change the default behavior of these attributes using Window/Saints/Create or Edit SaintsField Config

  • Type type = null

    The component type to assign. If null, it'll use the field type.

  • bool findObjectsInactive = false

    Should inactive GameObject be included? true to include inactive GameObject.

  • string groupBy = ""

    For error message grouping.

  • Allow Multiple: Yes

[GetInScene(bool includeInactive = true, Type compType = null, string groupBy = "")] is an alias of FindObjectsByType(null, true)

using SaintsField; [GetComponentInScene] public Dummy dummy; // by setting compType, you can assign it as a different type [GetComponentInScene(compType: typeof(Dummy))] public RectTransform dummyTrans; // and GameObject field works too [GetComponentInScene(compType: typeof(Dummy))] public GameObject dummyGo;

get_component_in_scene