Muse Behavior does not compile with Netcode for Gameobjects

Using unity 2022.3.29 I tried to install Muse Behavior 0.8.0 but the project fails to compile, it looks like MuseBehavior is missing an assemble reference to netcode:

The error:
Library\PackageCache\com.unity.muse.behavior@0.8.0\Runtime\Execution\Components\BehaviorGraphAgent.cs(7,13): error CS0234: The type or namespace name 'Netcode' does not exist in the namespace 'Unity' (are you missing an assembly reference?)

Among others these are the versions of the packages I am using:
"com.unity.muse.behavior": "0.8.0",
"com.unity.netcode.gameobjects": "1.9.1"

I would like to add that I am looking forward to be able to use Muse Behavior in a more mature project I have! It is a great tool and can’t wait until it gets out of experimental!

This is what the IDE tells me:

And I also saw this other post: Errors with Unity 2023.2.11.f1 that described a similar issue, but that was in a different unity version

Hi @jperezh , thank you for reporting this! I’ll get you a new version with a fix by the end of the week :crossed_fingers:

1 Like

Hi @jperezh, I’ve fixed it locally. I’m hoping to get the release out on Friday. Sorry about that!

1 Like

No problem at all!
Looking forward to try it out in my multiplayer project!

Hey @jperezh ,

The new version should be available now! Please let me know if you encounter anymore issues, I should be able to get hotfixes pretty quickly.

Note Monday is a bank holiday in the UK so it might be delayed to Tuesday, but I could get hotfixes today if you report them early enough! :slight_smile:

1 Like

Thanks @ShaneeNishry I can confirm that the issue is no longer present!

Now is possible to use Muse Behavior with Netcode for Game Objects! :smile:

I did had some issues where the Behavior Agent was not running for netcode objects that were placed in the scene before NetworkSpawn.
My scenario was an AI agent in the scene that had no logic in the AWAKE or START, most of it was in the OnNetworkSpawn, so it use to work.

But Muse Behavior Agent wants to Init on Awake, even before Netcode is initialized:

Perhaps also calling Init on line 90 could make sure the Behaviour is Only initialized OnNetworkSpawned?

Anyway I got around it by just spawning the game object at runtime instead of having it placed in the scene.

And that is also a different problem, the issue of this discussion is fixed!

Hey @jperezh ,

I’ll be honest, when I added support for netcode I was actively using netcode for gameobjects but I didn’t get to work on my prototype in a while and noticed this time my graphs didn’t run locally without an active netcode session so I quickly added the NetcodeRunOnlyOnOwner bool check.

Are you setting the graph programmatically then and only when you’re spawning the agent, which is why it’s an issue?

I can add an Init call back into the OnNetworkSpawn like it used to be and perhaps add !NetcodeRunOnlyOnOwner in the Awake one, what do you think? My intention is to avoid Init being called twice.

The other option is to add an Init call when you set the graph programmatically on the Graph setter API. I just need to make sure we’re not cloning it in cases we shouldn’t :slight_smile:

Let me know what you think, I could potentially get you a fix tomorrow!

Hey @ShaneeNishry,

Thanks for getting back!

The graph is not being set programmatically.

I have changed it so I spawn the agents at runtime, which has fit better my needs, after that all works as it should!

With that in mind I don’t think any change is needed :slight_smile:
I appreciate having the support for Netcode for game objects! It has been really helpful, is a great tool and I look forward to see it out of the experimental!

Awesome! I’m happy to see that. Let me know if you have any feedback, I’m always on the lookout for what we can do better :slight_smile:

I do have one question :grimacing:

Is there a way to have custom Blackboard variables?
I have 2 scenarios:

  1. I would like to be able to configure a variable of type LayerMask to for example detect collisions. So far I had been using ints, but It would be nice if instead they could be a LayerMask
  2. I would love to have the option to set a specific type as a blackboard variable, for example “Enemy” component. Currently this can be achieved by having a blackboard GameObject variable named Enemy and then in the start of the action (or when I need it) I just do a Enemy.Value.GetComponent<Enemy>() and if that is null it fails. But it would be nice to be able to skip that step.

Please take in mind that I am not saying this as a request but as a question/suggestion, perhaps is already possible and I just have not found how to.

I also noticed that the BehaviourAgentGraph component is set to internal if NetcodeForGameobjects is set:
Is there a reason for this?

Please let me know if I should create individual threads for these discussions

Hi @jperezh !

Unfortunately you can’t add custom variable types yet, but it is on our roadmap and I’m hoping to get it in sometime in June, or July at the latest. I’d also like us to have variable casting so you can assign a GameObject to a Transform or MonoBehaviour derivative, but this is somewhat more complicated and might be delayed, or worse, influence the implementation timeline for the custom types task.

As for the 2nd one, all the classes used to be internal in the past, so this is a leftover mistake. I’ll fix it for 0.9.2 and get a version out today. Note because it’s a change from internal to public it might force the next version to be 0.10.0 because of how the release tools work :slight_smile:

1 Like

Hello @ShaneeNishry
Any update on when can we have the BehaviourGraphAgent as public?
I want to disable it from another script (like when the AI agent dies) and so far I had to create a node that always checks if the agent is dead.
If the BehaviourGraphAgent was public I could just disable it from my Enemy class

Hi @jperezh , sorry for the delay I’ve been sick and the rest of the team is out on vacation. I’ll try to get you a version update today or tomorrow :slight_smile:

Oh no problem at all! There is no rush! The solution I have still works, I was just asking to see if there was an estimated time.

Thanks for the update!

Good to know :slight_smile: I’m hopeful a version can come out today! I’m just fixing the last few bugs and testing for regressions. It’s just me for the next few weeks, so I’m trying to test things as much as I can :slight_smile:

Can you try now? :slight_smile:

Amazing, just tried and now I can disable the BehaviorGraphAgent from a custom script!

Many thanks!

1 Like