Let's say I want some objects to be disabled when the game starts, and then I want to enable them with Ork event. Is there a built in way to do this? The find object does not search for disabled objects right?
hmm, I could not make it work with that. I'll try again. Meanwhile, I just whiped up a quick script which I put on Event object and then call ORK event message Enable or Disable on it. using System.Collections; using System.Collections.Generic; using UnityEngine;
namespace YourNameSpace { public class ObjectEnablerDisabler : MonoBehaviour {
public List<GameObject> Objects;
public void Enable() { for (int i = 0; i < Objects.Count; i++) { if (Objects[i] != null) Objects[i].SetActive(true); } }
public void Disable() { for (int i = 0; i < Objects.Count; i++) { if (Objects[i] != null) Objects[i].SetActive(false); } } }
Disabled game objects can't be found by Unity, so you'll have to define their actors as Object and disable Event Object and Find Object. This allows you to select the actor's game object in the event interaction's setup.
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Meanwhile, I just whiped up a quick script which I put on Event object and then call ORK event message Enable or Disable on it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace YourNameSpace
{
public class ObjectEnablerDisabler : MonoBehaviour
{
public List<GameObject> Objects;
public void Enable()
{
for (int i = 0; i < Objects.Count; i++)
{
if (Objects[i] != null)
Objects[i].SetActive(true);
}
}
public void Disable()
{
for (int i = 0; i < Objects.Count; i++)
{
if (Objects[i] != null)
Objects[i].SetActive(false);
}
}
}
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!