I have two scripts, one is located at:
Assets / Scriptable Objects / ...
while the other one is located at:
Assets / Scripts / ...
I have the first script encapsulated on a namespace.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using VoidlessNodes.LevelFlowNodes;
namespace VoidlessUtilities
{
[CreateAssetMenu]
public class LevelFlowData : BaseNodeEditorData<BaseLevelNode, LevelFlowEditorAttributes>
{
private const string MENU_ITEM_PATH = "Create / ScriptableObjects / LevelFlowData";
private const string NEW_ASSET_PATH = "ScriptableObjects / Level Flow Data";
[SerializeField] private string _name;
private RootLevelNode _root;
/// <summary>Gets and Sets name property.</summary>
public string name
{
get { return _name; }
set { _name = value; }
}
/// <summary>Gets and Sets root property.</summary>
public RootLevelNode root
{
get { return _root; }
set { _root = value; }
}
[MenuItem(MENU_ITEM_PATH)]
public static void CreateAsset()
{
LevelFlowData scriptableObject = ScriptableObject.CreateInstance<LevelFlowData>() as LevelFlowData;
AssetDatabase.CreateAsset(scriptableObject, AssetDatabase.GenerateUniqueAssetPath(NEW_ASSET_PATH));
}
public BaseLevelFlowNode GetLevelFlow()
{
BaseLevelFlowNode rootLevelFlow = null;
if(root != null)
{
rootLevelFlow = root.GetNode();
}
else
{
Debug.LogError("[LevelFlowData] Data has no RootLevelFlowNode saved");
}
return rootLevelFlow as RootLevelFlowNode;
}
}
}
And the other one is using the same namespace, which is a namespace I use for my custom scripts, but the only difference is that LevelFlowData's location is not under Scripts.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VoidlessUtilities;
public class TestLevelController : Singleton<TestLevelController>
{
[SerializeField] private LevelFlowData _levelFlowData;
[SerializeField] private List<GameObject> _testViews;
/// <summary>Gets and Sets levelFlowData property.</summary>
public LevelFlowData levelFlowData
{
get { return _levelFlowData; }
protected set { _levelFlowData = value; }
}
/// <summary>Gets and Sets testViews property.</summary>
public List<GameObject> testViews
{
get { return _testViews; }
set { _testViews = value; }
}
#region UnityMethods:
void OnEnable()
{
BaseInteractable.onTriggeredEvent += (int _eventID, bool _triggered)=> { Debug.Log("[TestLevelController] Event Triggered: " + _eventID); };
}
void OnDisable()
{
BaseInteractable.onTriggeredEvent -= (int _eventID, bool _triggered)=> { Debug.Log("[TestLevelController] Event Triggered: " + _eventID); };
}
/// <summary>TestLevelController's' instance initialization.</summary>
void Awake()
{
}
/// <summary>TestLevelController's starting actions before 1st Update frame.</summary>
void Start ()
{
}
/// <summary>TestLevelController's tick at each frame.</summary>
void Update ()
{
}
#endregion
#region PublicMethods:
public void EnableView(int _index)
{
testViews.SetAllActive(false);
testViews[_index].SetActive(true);
}
#endregion
#region PrivateMethods:
#endregion
}
Do I need to move LevelFlowData to Scripts, and make platform independet compilation (e.g., #if UNITY_EDITOR) encapsulation for UnityEditor namespace usage? Or is there another point I am missing?
This is the specific error log:
Assets/Scripts/Scene Controllers/TestLevelController.cs(10,27): error CS0246: The type or namespace name `LevelFlowData' could not be found. Are you missing an assembly reference?
Thanks in advance.