Insanely huge initial commit

This commit is contained in:
2026-02-21 17:04:05 -08:00
parent 9cdd36191a
commit 613d75914a
22525 changed files with 4035207 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);
}
}
}