Forum rules - please read before posting.

Action List Asset reference gone on play

edited June 2021 in Technical Q&A

Hi y'all

I tried several ways with and without prefab and several references, but it seems every time I hit the play button, the reference goes missing.
Other scripts/references work. Does anyone know how to fix this?

public class Meltdownphase : MonoBehaviour
{
public ActionListAsset MeltdownSequenz = null;
public Volume volume;

// Start is called before the first frame update
private void Awake()
{
    GlobalVariables GlobalVariables = GetComponent<GlobalVariables>();

    MeltdownSequenz = (ActionListAsset)Resources.Load("MeltdownSequenz") as ActionListAsset;
}

// Update is called once per frame
void Update()
{
    if (AC.GlobalVariables.GetBooleanValue(10)){
        Debug.Log("MELTDOWN");
        MeltdownSequenz.Interact();


    } 
}

}

Comments

  • The issue is that your "MeltdownSequenz" variable is both public (so can be assigned in the Inspector), but also reassigned in your Awake function by attempting to load a file from Resources into it.

    If you've assigned the correct asset in the Inspector, comment out the line:

    MeltdownSequenz = (ActionListAsset)Resources.Load("MeltdownSequenz") as ActionListAsset;
    
  • Ah, jeesh. That was exactly the problem!
    Sorry and thank you very much!!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.