Forum rules - please read before posting.

Error when creating a build of the game - 'List' could not be found.

edited February 2019 in Technical Q&A

Hi,

I'm trying to create a build of my game and I get this error:
error CS0246: The type or namespace name 'List' could not be found. Are you missing 'System.Collections.Generic' or `Boo.Lang' using directive?

This happens on each custom Action that has parameters. Error starts with the first line of this:

override public void AssignValues(List<ActionParameter> parameters)
        {
            myParameter= AssignFile(parameters, parameterID, constantID, myParameter);
        }

The problem is that each of these actions is already using the System.Collections.Generic, but it still throws an error. Here's a full list of the namespaces:

using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using System.Collections.Generic;
#endif

I used Action Template for all of the actions. The game works fine when playing it in Editor, but I get the errors when trying to build it - all errors are the same, start on the AssignValues line.

I never updated Unity or AC since I got both, any ideas what could be causing this?

AC Version: 1.65.2
Unity: 2018.2.18f1


EDIT:
I've swapped around the Systems.Collections.Generic and moved it above #if UNITY_EDITOR, so now it looks like this:

using UnityEngine;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
#endif

And it seems to be working?! Is there something else I should have done, or is "if it works, it works" scenario?

Comments

  • No, that's correct - AssignValues is called at runtime, so it needs access to the library at all times.

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.