I'm trying to embed a model that I trained in my c# unity script. By doing something like this
using UnityEngine;
using UnityEngine.UI;
using MLAgents;
public class loadImage : MonoBehaviour {
public NNModel modelSource;
var model = ModelLoader.Load(modelSource);
This was prescribed by these barracuda docs on unity's github. However, i get the error
The type or namespace 'NModel' could not be found. Are you missing a using directive or assembly reference?
Don't really know how I could be adding that Quite new to c# and Unity programming, so the cause for this error could be rather basic. Am I forgetting something?
Thanks!
You can see e.g. in BarracudaModelParamLoader
the only namespace besides the System
ones is Barracula
and it uses NModel
;)
So NModel
seems to be part of the Barracula
namespace.
Simply add
using Barracuda;
at the top of your script.
Also make sure that the Baracccula .dll
files are imported and compatible with the target platform.
In general: I would strongly recommend to use a proper IDE like e.g. VisualStudio for doing your coding. It usually can automatically suggest the required fixes for missing namespaces.