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
BarracudaModelParamLoaderthe only namespace besides theSystemones isBarraculaand it usesNModel;)So
NModelseems to be part of theBarraculanamespace.Simply add
at the top of your script.
Also make sure that the Baracccula
.dllfiles 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.