22 lines
495 B
C#
22 lines
495 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ParentObject : MonoBehaviour
|
|
{
|
|
public Transform parent;
|
|
public Transform targetChild;
|
|
|
|
public bool makeChildPosZeroToParent;
|
|
|
|
public void MakeParent()
|
|
{
|
|
targetChild.SetParent(parent);
|
|
if (makeChildPosZeroToParent)
|
|
{
|
|
targetChild.localPosition = Vector3.zero;
|
|
targetChild.localRotation = new Quaternion(0, 0, 0, 0);
|
|
}
|
|
}
|
|
}
|