playMaker

Author Topic: compiler errors from visual studio  (Read 881 times)

Matthew Reilly

  • Playmaker Newbie
  • *
  • Posts: 20
compiler errors from visual studio
« on: May 16, 2019, 04:46:01 AM »
Hello,

I'm getting compiler errors on a script moving from Visual Studio Code to Unity & am wondering if this is a Unity issue or Playmaker related. Here is the message:

Assets/Scripts/XMLManager.cs(19,27): error CS0116: A namespace cannot directly contain members such as fields or methods

Am I missing something? Here's the script it's complaining about:
Code: [Select]
using UnityEngine;
using System.Collections;

using System.Collections.Generic;   //lets us use lists
using System.Xml;                   //basic xml attributes
using System.Xml.Serialization;     //access xmlserializer
using System.IO;                    //file management

public class XMLManager : MonoBehaviour {

    // terrible singleton pattern
   public static XMLManager ins;

   void Awake(){
       ins = this;       
    }
}
    //list of items
    internal ItemDatabase ItemDB;



[System.Serializable]
public class ItemEntry {
    public string word;
    public string partofspeech;
    public int value;
}

[System.Serializable]
public class ItemDatabase {

        public List<ItemEntry> list = new List<ItemEntry>();

}

public enum partofspeech {
    Noun,
    Propernoun,
    Adjective,
    Adverb,
    Verb,
    Number,
    Phrase
}
« Last Edit: May 16, 2019, 07:36:59 AM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: compiler errors from visual studio
« Reply #1 on: May 16, 2019, 07:43:17 AM »
Hi.
I wrapped your code so it is easier to read.

From what i understand there is an issue with this : internal ItemDatabase ItemDB;

But this has nothing to do with PlayMaker.

It is probably from another asset (maybe some inventory asset?)