Example #1
0
    private void DeleteRoot()
    {
        ShadowVolumeRoot root = FindObjectOfType <ShadowVolumeRoot>();

        if (root != null)
        {
            DestroyImmediate(root.gameObject);
        }
    }
Example #2
0
    private Transform GetRoot()
    {
        ShadowVolumeRoot root = FindObjectOfType <ShadowVolumeRoot>();

        if (root == null)
        {
            GameObject rootGo = new GameObject("_$ShadowVolumeRoot$_");
            rootGo.transform.parent           = null;
            rootGo.transform.localScale       = Vector3.one;
            rootGo.transform.localEulerAngles = Vector3.zero;
            rootGo.transform.localPosition    = Vector3.zero;
            rootGo.AddComponent <ShadowVolumeRoot>();
            return(rootGo.transform);
        }
        else
        {
            return(root.transform);
        }
    }