/
TON618OFF
/
Unity-Project-RTU
Обзор
Документация
Войти
/
TON618OFF
/
Unity-Project-RTU
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Library/PackageCache/com.unity.visualscripting@1.9.4/Runtime/VisualScripting.Core/Variables/ObjectVariables.cs
34 строки
885 B
TON618OFF
release
03 окт 2024, 22:20
03 окт 2024, 22:20
7c70e9f
Код
Авторство
О чём код?
using System; using UnityEngine; namespace Unity.VisualScripting { public static class ObjectVariables { public static VariableDeclarations Declarations(GameObject source, bool autoAddComponent, bool throwOnMissing) { Ensure.That(nameof(source)).IsNotNull(source); var variables = source.GetComponent<Variables>(); if (variables == null && autoAddComponent) { variables = source.AddComponent<Variables>(); } if (variables != null) { return variables.declarations; } if (throwOnMissing) { throw new InvalidOperationException($"Game object '{source.name}' does not have variables."); } else { return null; } } } }