Hey,

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?
  • I think it works if you check "Scene Object" or sth, when you add actors
  • edited September 4
    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);
    }
    }
    }
    Post edited by hellwalker on
  • 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.
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • Neat, thanks !
Sign In or Register to comment.