• edited December 5
    yes of course I tried that. again it does'nt call the lightsOFF when I get out of the interaction range, and also when it's only 1 item it disappears the item weirdly...

    my script (with the correct functions-spelling of lightOff and lightOn):

    using UnityEngine;
    using ORKFramework.Behaviours;

    public class CustomInteractionController : InteractionController


    {

    public override void SortInteractions()
    {
    if (this.list.Count > 0)
    {
    shaderGlow comp = this.list[0].GetComponent();
    if (comp != null)
    {
    comp.lightOff();

    }
    }

    base.SortInteractions();

    if (this.list.Count > 0)
    {
    shaderGlow comp = this.list[0].GetComponent();
    if (comp != null)
    {
    comp.lightOn();

    }
    }
    }
    }


    also having these 2 warnings (not errors):

    The referenced script on this Behaviour (Game Object '') is missing!
    UnityEngine.Object:Instantiate(GameObject, Vector3, Quaternion)
    ORKFramework.UnityWrapper:InstantiateGameObject(GameObject, Vector3, Quaternion)
    ORKFramework.UnityWrapper:Instantiate(GameObject, Vector3, Quaternion)
    ORKFramework.Combatants.CombatantObject:Spawn(Vector3, Boolean, Single, Boolean, Vector3)
    ORKFramework.PlayerHandler:SpawnPlayer(Vector3, Boolean, Single, Boolean, Vector3)
    ORKFramework.PlayerHandler:SpawnPlayer(Int32)
    ORKFramework.Events.Steps.SpawnPlayerStep:Execute(BaseEvent)
    ORKFramework.Events.GameEvent:ExecuteNextStep()
    ORKFramework.Events.BaseEvent:StepFinished(Int32)
    ORKFramework.Events.Steps.JoinActiveGroupStep:Execute(BaseEvent)
    ORKFramework.Events.GameEvent:ExecuteNextStep()
    ORKFramework.Events.BaseEvent:StartEvent()
    ORKFramework.Events.GameEvent:StartEvent(IEventStarter, Object)
    ORKFramework.Behaviours.d__29:MoveNext()
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    ORKFramework.Behaviours.EventInteraction:StartEvent(GameObject)
    ORKFramework.Behaviours.BaseInteraction:DoAutoStart()
    ORKFramework.Behaviours.EventInteraction:CheckAutoStart()
    ORKFramework.Behaviours.EventInteraction:Start()


    The referenced script on this Behaviour (Game Object 'FPSCustomController_Uni_PPS') is missing!
    UnityEngine.Object:Instantiate(GameObject, Vector3, Quaternion)
    ORKFramework.UnityWrapper:InstantiateGameObject(GameObject, Vector3, Quaternion)
    ORKFramework.UnityWrapper:Instantiate(GameObject, Vector3, Quaternion)
    ORKFramework.Combatants.CombatantObject:Spawn(Vector3, Boolean, Single, Boolean, Vector3)
    ORKFramework.PlayerHandler:SpawnPlayer(Vector3, Boolean, Single, Boolean, Vector3)
    ORKFramework.PlayerHandler:SpawnPlayer(Int32)
    ORKFramework.Events.Steps.SpawnPlayerStep:Execute(BaseEvent)
    ORKFramework.Events.GameEvent:ExecuteNextStep()
    ORKFramework.Events.BaseEvent:StepFinished(Int32)
    ORKFramework.Events.Steps.JoinActiveGroupStep:Execute(BaseEvent)
    ORKFramework.Events.GameEvent:ExecuteNextStep()
    ORKFramework.Events.BaseEvent:StartEvent()
    ORKFramework.Events.GameEvent:StartEvent(IEventStarter, Object)
    ORKFramework.Behaviours.d__29:MoveNext()
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    ORKFramework.Behaviours.EventInteraction:StartEvent(GameObject)
    ORKFramework.Behaviours.BaseInteraction:DoAutoStart()
    ORKFramework.Behaviours.EventInteraction:CheckAutoStart()
    ORKFramework.Behaviours.EventInteraction:Start()
    Post edited by dlevel on
  • If the name of the component is shaderGlow, you need to use this line to get the component:
    shaderGlow comp = this.list[0].GetComponent<shaderGlow>();
    But make sure the name of the component is correct.

    The warnings let you know that some of the components on game objects you're spawning are missing their script references. I.e. the scripts of those components have either been removed or renamed and Untiy can't find them any more. To fix this, you either need to select the correct script for them or remove the components.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited December 8
    don't know why it didnt pasted the correct way, this is how I have it.

    public class CustomInteractionController : InteractionController

    {

    public override void SortInteractions()
    {
    if (this.list.Count > 0)
    {
    shaderGlow comp = this.list[0].GetComponent();
    if (comp != null)
    {
    comp.lightOff();

    }
    }

    base.SortInteractions();

    if (this.list.Count > 0)
    {
    shaderGlow comp = this.list[0].GetComponent();
    if (comp != null)
    {
    comp.lightOn();

    }
    }
    }
    }


    lol again it doesn't include the shaderGlow inside the brackets (it dissapears when I post the comment here, maybe its an html or sth), anyway I have it exactly as you have it. And yes it is correct, it just has the behavior I describe in my previous post
    Post edited by dlevel on
  • Alright, if you don't get any errors for the interaction controller, I'd assume it didn't find the component, try this line instead:
    shaderGlow comp = this.list[0].GetComponentInChildren<shaderGlow>();
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited December 6
    exact same behavior. It does find the component because it calls it, but when getting out of the interaction range it doesn't disable it, and when it's only 1 object the 3d object also disappears. Maybe is something to do with triggerEnter and triggerExit? or maybe because both try to call when its > 0 ?
    Post edited by dlevel on
  • Ah, yeah, that case you need to override the trigger exit function:

    protected override void OnTriggerExit(Collider other)
    {
    base.OnTriggerExit(other);
    CustomComponent comp = other.gameObject.GetComponentInChildren<CustomComponent>();
    if(comp != null)
    {
    comp.lightsON();
    }
    }
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited December 8
    So the first part works fine for 1 object (TriggerEnter and TriggerExit), but when I have many objects it lights on all of them so I m trying to do the SortInteraction think without success again, having the issues I had before. Any idea?



    using System;
    using UnityEngine;
    using ORKFramework.Behaviours;

    public class CustomInteractionController : InteractionController


    {

    protected override void OnTriggerEnter(Collider other)
    {
    base.OnTriggerEnter(other);
    shaderGlow comp = other.gameObject.GetComponentInChildren<shaderGlow>();
    if (comp != null)
    {
    comp.lightOn();
    }
    }

    protected override void OnTriggerExit(Collider other)
    {
    base.OnTriggerExit(other);
    shaderGlow comp = other.gameObject.GetComponentInChildren<shaderGlow>();
    if (comp != null)
    {
    comp.lightOff();
    }
    }

    public override void SortInteractions()
    {
    if (this.list.Count > 0)
    {
    shaderGlow comp = this.list[0].GetComponentInChildren<shaderGlow>();
    if (comp != null)
    {
    comp.lightOff();

    }
    }

    base.SortInteractions();

    if (this.list.Count > 0)
    {
    shaderGlow comp = this.list[0].GetComponentInChildren<shaderGlow>();
    if (comp != null)
    {
    comp.lightOn();

    }
    }
    }


    }

    Post edited by dlevel on
  • Yeah, don't override the OnTriggerEnter function, as that'll light all objects that enter the trigger.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.