Woland писал(а):Что такое isPoweredOn?
Булевая переменная в скрипте InteractiveLight , который находиться на объекте с тегом onoff.
Я так понимаю должно быть что-то вроде
Синтаксис:
Используется csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Trigger2 : MonoBehaviour
{
public GameObject[] Obj;
private InteractiveLight lighter;
// Start is called before the first frame update
void Start()
{
Obj = GameObject.FindGameObjectsWithTag("onoff");
lighter = GetComponent<InteractiveLight>();
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter(Collider other)
{
for (int i = 0; i <= Obj.Length - 1; i++)
{
Obj[i].lighter.isPoweredOn = true;
}
}
}
using System.Collections.Generic;
using UnityEngine;
public class Trigger2 : MonoBehaviour
{
public GameObject[] Obj;
private InteractiveLight lighter;
// Start is called before the first frame update
void Start()
{
Obj = GameObject.FindGameObjectsWithTag("onoff");
lighter = GetComponent<InteractiveLight>();
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter(Collider other)
{
for (int i = 0; i <= Obj.Length - 1; i++)
{
Obj[i].lighter.isPoweredOn = true;
}
}
}
Но оно не работает