You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
594 B
C#
25 lines
594 B
C#
using UnityEngine;
|
|
|
|
namespace D2D.Cameras
|
|
{
|
|
public class AttachSelfToCameraOnStart : MonoBehaviour
|
|
{
|
|
[SerializeField] private bool _isZeroLocalPosition = true;
|
|
[SerializeField] private Vector3 swift;
|
|
|
|
private void Start()
|
|
{
|
|
var cam = FindObjectOfType<Camera>();
|
|
transform.parent = cam.transform;
|
|
|
|
if (_isZeroLocalPosition)
|
|
{
|
|
transform.localPosition = Vector3.zero;
|
|
}
|
|
else
|
|
{
|
|
transform.localPosition = swift;
|
|
}
|
|
}
|
|
}
|
|
} |