I got 2 big problems that after a lot of research I´m unable to solve.
First problem: I got 5 xml files and a sub-folder inside the Resources folder but when I build my project, the Resources folder is empty (well, only two unity files in there: unity default resources and unity_builtin_extra. So I can´t access my xml files when I do: Resources.Load, anywhere on my code.
I post images to clarify:
Second problem: As Resources file was not working I decided to use public variables for my xml files declaring: public TextAsset myXmlDoc, but I realize that, only when I build this isn´t working as it gets NullReferenceException as if my public TextAsset variable wasn’t assigned by me (wich is not true)
I post images and code to clarify:
public class LoadXml_Narrator : MonoBehaviour {
NarratorTextClass narratorClass;
public TextAsset file;
void Awake()
{
print("Xml file " + file);
}
}
This is the output log of my Build:
NullReferenceException: Object reference not set to an instance of an object
at LoadXml_Narrator.Awake () [0x0001d] in D:\Projects\PC\Majorel_\Majorel_\Assets\Scripts\XML\Narrator\LoadXml_Narrator.cs:20
(Filename: D:/Projects/PC/Majorel_/Majorel_/Assets/Scripts/XML/Narrator/LoadXml_Narrator.cs Line: 20)
Note: IN the editor everything works
perfect. The issue is only when build
and execute the project.