전역 인스펙터 컨테이너





GameManager.cs 소스입니다



using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public class Container
{
    [SerializeField] Transform _circle; 
    public static Transform circle;

    [SerializeField] Transform _square;
    public static Transform square;

    public void Init() 
    {
        circle = _circle;
        square = _square;
    }
}

public class GameManager : MonoBehaviour
{
    [SerializeField] Container container;

void Awake()
{
        container.Init();
    }
}






Other.cs 소스입니다


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static Container;

public class Other : MonoBehaviour
{
    void Start()
    {
        circle.position = Vector3.up;
        square.position = Vector3.down;
    }
}