25 lines
494 B
C#
25 lines
494 B
C#
|
using System;
|
|||
|
using Sirenix.OdinInspector;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace UnityTest.ZXL
|
|||
|
{
|
|||
|
public class BindUICamera : MonoBehaviour
|
|||
|
{
|
|||
|
public GameObject go;
|
|||
|
public Camera uiCamera;
|
|||
|
|
|||
|
private void Start()
|
|||
|
{
|
|||
|
Add();
|
|||
|
}
|
|||
|
|
|||
|
[Button]
|
|||
|
void Add()
|
|||
|
{
|
|||
|
go = GameObject.Find("UICamera");
|
|||
|
uiCamera = go.GetComponent<Camera>();
|
|||
|
GetComponent<Canvas>().worldCamera = uiCamera;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|