Insanely huge initial commit

This commit is contained in:
2026-02-21 16:40:15 -08:00
parent 2ba1c94b88
commit ee9aee0a1b
33825 changed files with 5213498 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MoreMountains.Tools
{
/// <summary>
/// This component lets you parent the transform you put it on to any target parent (or to the root if none is set), on Awake, Start or anytime you call its Parent() method
/// </summary>
public class MMParentingOnStart : MonoBehaviour
{
/// the possible modes this can run on
public enum Modes { Awake, Start, Script }
/// the selected mode
public Modes Mode = Modes.Awake;
/// the parent to parent to, leave empty if you want to unparent completely
public Transform TargetParent;
/// <summary>
/// On Awake we parent if needed
/// </summary>
protected virtual void Awake()
{
if (Mode == Modes.Awake)
{
Parent();
}
}
/// <summary>
/// On Start we parent if needed
/// </summary>
protected virtual void Start()
{
if (Mode == Modes.Start)
{
Parent();
}
}
/// <summary>
/// Sets this transform's parent to the target
/// </summary>
public virtual void Parent()
{
this.transform.SetParent(TargetParent);
}
}
}