Skip to main content

GameObjectExtensions.LoadedOrNonPrefab

Declaration#

public static bool LoadedOrNonPrefab(GameObject gameObject)

Parameters#

NameDescription
gameObjectGameObject to check

Description#

Check if a GameObject is loaded in the scene or has a non -1 index

Usage#

Example
using NullSave.GDTK;using UnityEngine;
public class Example : MonoBehaviour{
    public void ExampleMethod(GameObject target)    {        // Check if the target is already loaded in this scene        // Or if it is a prefab        // This is useful for hiding Templates at runtime        if(target.LoadedOrNonPrefab())        {            target.SetActive(false);        }    }}