acdamiani / schema Goto Github PK
View Code? Open in Web Editor NEWVisual intelligence for the Unity game engine
Home Page: https://schema-ai.com
License: MIT License
Visual intelligence for the Unity game engine
Home Page: https://schema-ai.com
License: MIT License
Modifiers, including the LoopUntil modifier, are currently not allowed to have BlackboardEntrySelector
fields, claiming that Modifiers are "non tree" types. This should necessitate an update to the BlackboardEntrySelectorDrawer
type checking logic.
Above
schema/Runtime/Proc/ExecutableNode.cs
Line 320 in 3bc87e4
action.OnNodeExit(nodeMemory[id], context.agent);
should be called.
If this does not happen, cleanup or update tasks cannot run if after a conditional evaluation the node is aborted.
It might be helpful for users to be able to run nodes in parallel, allowing more detailed logic without the need for writing custom nodes or conditionals. Behavior Designer does something similar.
unity 2021.3.21f1 editor
IndexOutOfRangeException: Index was outside the bounds of the array.
QuickSearch.Search (System.String needle, System.String haystack) (at Assets/Schema/Editor/Window/QuickSearch.cs:342)
QuickSearch.SearchThroughResults (System.Collections.Generic.IEnumerable1[T] types, System.String query) (at Assets/Schema/Editor/Window/QuickSearch.cs:322) QuickSearch.<CorrectSelection>b__31_0 () (at Assets/Schema/Editor/Window/QuickSearch.cs:298) Schema.Utilities.CacheDictionary
2[T1,T2].GetOrCreate (T1 key, System.Func`1[TResult] default) (at Assets/Schema/Utilities/CacheDictionary.cs:13)
QuickSearch.CorrectSelection (System.Int32 selected) (at Assets/Schema/Editor/Window/QuickSearch.cs:298)
QuickSearch.Focus () (at Assets/Schema/Editor/Window/QuickSearch.cs:286)
QuickSearch.OnGUI (System.Int32 id) (at Assets/Schema/Editor/Window/QuickSearch.cs:65)
UnityEngine.GUI.CallWindowDelegate (UnityEngine.GUI+WindowFunction func, System.Int32 id, System.Int32 instanceID, UnityEngine.GUISkin _skin, System.Int32 forceRect, System.Single width, System.Single height, UnityEngine.GUIStyle style) (at :0)
UnityEditor.EditorWindow:EndWindows()
SchemaEditor.Internal.ComponentSystem.Components.WindowComponent:OnGUI() (at Assets/Schema/Editor/Canvas/Components/WindowComponent.cs:61)
SchemaEditor.Internal.ComponentCanvas:Draw() (at Assets/Schema/Editor/Canvas/ComponentCanvas.cs:265)
SchemaEditor.NodeEditor:OnGUI() (at Assets/Schema/Editor/Window/NodeEditorGUI.cs:45)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Hi @acdamiani
In this example I would expect that only two checks are made since the tree should never reach this node:
But unfortunately all three conditionals are checked.
Only when a conditional has abort conditions.
If this is intended I would like to understand the advantage.
Best,
Christian
Hey guys,
I guess I've found an error.
In Schema.Builtin.Nodes.OverlapSphere
inside Tick method there are made checks against GameObject and Transform. But these are Unity GameObject and Transform Classes.
None of the 4 if statements returns true.
But if I change the code to:
public override NodeStatus Tick(object nodeMemory, SchemaAgent agent)
{
Collider[] colliders =
Physics.OverlapSphere(position.value, radius.value, layerMask, queryTriggerInteraction);
if (colliders.Length == 0)
return NodeStatus.Failure;
if (hit.entryType == typeof(Schema.Internal.Types.GameObject) || hit.isDynamic)
hit.value = colliders[0].gameObject;
else if (hit.entryType == typeof(List<Schema.Internal.Types.GameObject>))
hit.value = colliders.Select(collider => collider.gameObject).ToList();
else if (hit.entryType == typeof(Schema.Internal.Types.Transform))
hit.value = colliders[0].transform;
else if (hit.entryType == typeof(List<Schema.Internal.Types.Transform>))
hit.value = colliders.Select(collider => collider.transform).ToList();
return NodeStatus.Success;
}
It works perfectly.
I'm using Unity 2022.3.16f1 (LTS).
Am I using it wrong or does that have to do something with the Unity Version ?
Thx in Advance
Just in case you oversee it:
Maybe the new
statement is the bad guy here.
public class RotateTowardsVector : Action
{
[Tooltip("Current managed vector")] public BlackboardEntrySelector current = new BlackboardEntrySelector(); // <-- this one
[Tooltip("Target vector")] public BlackboardEntrySelector target = new BlackboardEntrySelector(); // <-- this one
[Tooltip("The maximum angle in radians allowed for this rotation")]
public BlackboardEntrySelector<float> maxRadiansDelta;
[Tooltip("The maximum allowed change in vector magnitude for this rotation")]
public BlackboardEntrySelector<float> maxMagnitudeDelta;
[Tooltip("Blackboard variable to store the new rotated vector in"), WriteOnly]
public BlackboardEntrySelector rotated = new BlackboardEntrySelector(); // <-- this one
It looks like there is an issue with Conditional aborts as detailed in issue #6. It looks like a logical error in the ExecutableNode.RunDynamicConditionals
method. It might be helpful to refactor the boolean logic here, since it's pretty messy and difficult to parse.
Hi @acdamiani
I've updated Schema AI via import from git (before I downloaded it from Asset Store).
When I open my Graph, I get this error message / stack trace:
Broken text PPtr in file(Assets/Prefabs/Enemies/BaseAIGraph.asset). Local file identifier (86440366174919129) doesn't exist!
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Exception thrown while invoking [OnOpenAssetAttribute] method 'SchemaEditor.NodeEditor:Open (int,int)' : NullReferenceException: Object reference not set to an instance of an object
SchemaEditor.Internal.ComponentSystem.Components.ConditionalComponent.Create (SchemaEditor.Internal.ComponentSystem.CreateArgs args) (at ./Library/PackageCache/com.acdamiani.schema@15b26ec482/Editor/Canvas/Components/ConditionalComponent.cs:177)
SchemaEditor.Internal.ComponentCanvas.Create[T] (SchemaEditor.Internal.ComponentSystem.CreateArgs args) (at ./Library/PackageCache/com.acdamiani.schema@15b26ec482/Editor/Canvas/ComponentCanvas.cs:99)
SchemaEditor.NodeEditor.RebuildComponentTree () (at ./Library/PackageCache/com.acdamiani.schema@15b26ec482/Editor/Window/NodeEditorGUI.cs:390)
SchemaEditor.NodeEditor.Open (Schema.Graph graphObj) (at ./Library/PackageCache/com.acdamiani.schema@15b26ec482/Editor/Window/NodeEditor.cs:142)
SchemaEditor.NodeEditor.OpenGraph (Schema.Graph graphObj) (at ./Library/PackageCache/com.acdamiani.schema@15b26ec482/Editor/Window/NodeEditor.cs:133)
SchemaEditor.NodeEditor.Open (System.Int32 instanceID, System.Int32 line) (at ./Library/PackageCache/com.acdamiani.schema@15b26ec482/Editor/Window/NodeEditor.cs:278)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Blackboard entries are still there but conditionals and connections seem to be gone at least visually.
I've added my Graph Asset and my custom Action and Conditional for you to reproduce it.
After going back to v 1.0.5 from Asset Store I still get the same error and I cannot create new connections. :-(
Hello again :)
The Idle Node is nice but it's useless for me since there is no way to abort it conditionally.
In the description is stated, that it can be pulled of from the flow by a decorator.
namespace Schema.Builtin.Nodes
{
[Description("Will stop execution of the tree perpetually, until flow is pulled from it by a Decorator."),
Category("Miscellaneous")]
public class Idle : Action
{
public override NodeStatus Tick(object nodeMemory, SchemaAgent agent)
{
return NodeStatus.Running;
}
}
}
There are no concrete decorators in the code. The only classes that could be a node decorator are the conditionals and the modifiers.
The only modifier that could possibly used is the LoopUntil
modifier. But for the public BlackboardEntrySelector<bool> condition;
I'm getting an error in editor from BlackboardEntrySelectorDrawer
:
in
public static string DoSelectorDrawer(Rect position, SerializedProperty property, GUIContent label,
Type fieldType, FieldInfo fieldInfo)
{
Type parentType = property.serializedObject.targetObject.GetType();
if (!valid.Any(t => t.IsAssignableFrom(parentType)))
{
GUI.Label(position,
new GUIContent("Cannot use a BlackboardEntrySelector in a non tree type",
Icons.GetEditor("console.warnicon")), EditorStyles.miniLabel);
return "";
}
/// [...]
}
The Conditionals are not executed on a node that has returned a Running status in the last tick.
The only way to abort a node that is Running (e.g. MoveTo) is to write own custom logic into a new node.
Imagine this situation:
An enemy moves to a position 50 meters away and I walk to him. I'm right in front of him. He just ignores me until he has reached his location. There is no way to handle that problem without coding.
Or did I do misunderstand something ?
Thanks in advance for you help and hopefully explanations. :)
The documentation currently only addresses Conditional aborts in passing. It would be worth it to expound upon what they are and how they work, since they are pretty important for any mildly complex behavior tree.
When to remove an entry from the Blackboard, some references on Nodes are gone.
How to reproduce:
Then some (not all) references from nodes and conditionals are gone.
Have a look at the video:
https://github.com/acdamiani/schema/assets/20422129/dc7782b0-79c2-469c-b817-1a0d93ce38ec
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.