Comments (11)
Hello,
Can you send the error stacktrace you have in the console?
from nodegraphprocessor.
The error is a missing reference in this case it will happen in "HasLessHealthThenX" but i could change the first node evaluated and i would have the same result.
Error StackTrace :
System.NullReferenceException: Object reference not set to an instance of an object at FracLib.NodeGraph.TreeBehavior.HasLessHealthThenX.Evaluate () [0x00008] in C:\Users\JEJELITE\Documents\GitHub\ObsoletePrototype\ObsoleteProto\Assets\_Test_TreeBehavior\HasLessHealthThenX.cs:21 at FracLib.NodeGraph.TreeBehavior.SequenceNode.Evaluate () [0x0001a] in C:\Users\JEJELITE\Documents\GitHub\ObsoletePrototype\ObsoleteProto\Assets\FracLib\NodeGraph\TreeBehavior\Nodes\Composite\SequenceNode.cs:19 at FracLib.NodeGraph.TreeBehavior.SelectorNode.Evaluate () [0x00018] in C:\Users\JEJELITE\Documents\GitHub\ObsoletePrototype\ObsoleteProto\Assets\FracLib\NodeGraph\TreeBehavior\Nodes\Composite\SelectorNode.cs:18 at FracLib.NodeGraph.TreeBehavior.StartNode.Evaluate () [0x00018] in C:\Users\JEJELITE\Documents\GitHub\ObsoletePrototype\ObsoleteProto\Assets\FracLib\NodeGraph\TreeBehavior\Nodes\StartNode.cs:26 at FracLib.NodeGraph.TreeBehavior.StartNode.Process () [0x00001] in C:\Users\JEJELITE\Documents\GitHub\ObsoletePrototype\ObsoleteProto\Assets\FracLib\NodeGraph\TreeBehavior\Nodes\StartNode.cs:19 at GraphProcessor.BaseNode.<OnProcess>b__52_0 () [0x00000] in C:\Users\JEJELITE\Documents\GitHub\ObsoletePrototype\ObsoleteProto\Library\PackageCache\[email protected]\Runtime\Elements\BaseNode.cs:356 at GraphProcessor.ExceptionToLog.Call (System.Action a) [0x00002] in C:\Users\JEJELITE\Documents\GitHub\ObsoletePrototype\ObsoleteProto\Library\PackageCache\[email protected]\Runtime\Utils\ExceptionToLog.cs:14 UnityEngine.Debug:LogError(Object) GraphProcessor.ExceptionToLog:Call(Action) (at Library/PackageCache/[email protected]/Runtime/Utils/ExceptionToLog.cs:19) GraphProcessor.BaseNode:OnProcess() (at Library/PackageCache/[email protected]/Runtime/Elements/BaseNode.cs:356) GraphProcessor.ProcessGraphProcessor:Run() (at Library/PackageCache/[email protected]/Runtime/Processing/ProcessGraphProcessor.cs:39) Testing:Execute() (at Assets/_Test_TreeBehavior/Testing.cs:38) System.Reflection.MethodBase:Invoke(Object, Object[]) Sirenix.OdinInspector.Editor.Drawers.DefaultMethodDrawer:InvokeButton() (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/DefaultMethodDrawer.cs:388) Sirenix.OdinInspector.Editor.Drawers.DefaultMethodDrawer:DrawNormalButton() (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/DefaultMethodDrawer.cs:237) Sirenix.OdinInspector.Editor.Drawers.DefaultMethodDrawer:DrawPropertyLayout(GUIContent) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Misc Drawers/DefaultMethodDrawer.cs:149) Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(GUIContent) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinDrawer.cs:176) Sirenix.OdinInspector.Editor.InspectorProperty:Draw(GUIContent) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:602) Sirenix.OdinInspector.Editor.InspectorUtilities:DrawPropertiesInTree(PropertyTree) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/InspectorUtilities.cs:418) Sirenix.OdinInspector.Editor.PropertyTree:Draw(Boolean) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:308) Sirenix.OdinInspector.Editor.OdinEditor:DrawTree() (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinEditor.cs:93) Sirenix.OdinInspector.Editor.OdinEditor:DrawOdinInspector() (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinEditor.cs:215) Sirenix.OdinInspector.Editor.OdinEditor:OnInspectorGUI() (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinEditor.cs:85) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
from nodegraphprocessor.
So, If I understand correctly the crash happens when you do
var p = graph.GetParameterValue("...");
in HasLessHealthThenX.cs:21 ?
Can you also check that the graph is not null? It's very unlikely but who knows
from nodegraphprocessor.
The "Null reference" error occur when running the graph for the first time with "processor.Run()" , so no the error doesn't occur directly on the line "var p = graph.GetParameterValue("...");".
What is strange is that every parameters are set correctly if i run a second time the graph without changing anything.
Here is the code of the node in question (note that it happen on any node referencing a exposed parameter)
[Input(name = "More Then", allowMultiple = false)]
public int moreThen;
[Input(name = "entity", allowMultiple = false), SerializeField]
public RPGEntity entity;
public override NodeState Evaluate()
{
nodeState = NodeState.RUNNING;
if (entity.health < moreThen) //<-- ERROR HERE
nodeState = NodeState.SUCCESS;
else
nodeState = NodeState.FAILURE;
return nodeState;
}
from nodegraphprocessor.
Hum, it's weird I tried to repro with a simple scriptable object that I expose as a parameter and then I run the graph from a script but it works correctly.
Just as a sanity check: what happens if you connect a Debug.Log node to the parameter node "This Entity"? Is it null on the first run or have the correct value?
from nodegraphprocessor.
The Debug.log reflect the same problem, the entity appear null on the first run, if i rerun the graph it's set correctly.
from nodegraphprocessor.
Then maybe it's a compute order problem, can you check that the nodes are processed in the correct order? you can enable debug mode on the node to display the compute order:
If it's not that I really don't know. Maybe if you don't mind you can send me your project or a unity pacakge if it's not too big for a repro?
from nodegraphprocessor.
Ok, sry for the delay i took a week off , the problem is not from the compute order. I just sent you a invite to a repo with a package containing the example and code we used for testing the api if you want to take a look.
Thanks for your help and patience.
from nodegraphprocessor.
👍 I'll take a look
from nodegraphprocessor.
So I took a look and there is indeed something in your code that breaks evaluation of the graph (from SequenceNode):
bool anyChildRunning = false;
foreach (TreeBehaviorNode node in GetChildren())
{
==> switch (node.Evaluate())
{
case NodeState.FAILURE:
nodeState = NodeState.FAILURE;
return nodeState;
This switch line call the Evalute on a node that have not yet been evaluated, but this also means that this node was not ready to be executed. In this precise case, the parameter node hasn't been processed yet when we process the SequenceNode
so it's value is not yet sent to the HasLessHealthThenX
node.
This explains why on the first run, you don't have the correct value in your node (your code basically shortcuts the graph execution order and thus gives in incorrect results).
Note that doing this also doesn't work because you are using the ProcessGraphProcessor
in your Testing.cs which will result in the execution of all the nodes in the graph, completely ignoring the logic you have in your conditional nodes.
I think the correct solution in this case is to modify the ProcessGraphProcessor or write a new one. You have an example of conditional processing in this repo here: https://github.com/alelievr/NodeGraphProcessor/blob/master/Assets/Examples/ConditionalGraph/ConditionalProcessor.cs#L83
It's probably more complicated than what you need but it should be a good example.
from nodegraphprocessor.
Thanks for the answer! Will look into implementing a custom GraphProcessor for a ThreeBehavior logic. I was initially hoping to avoid that.That why i try what i did but i for some reason didn't think that the node would not be set properly because of that.
Thanks again
from nodegraphprocessor.
Related Issues (20)
- Node categories
- CustomPortBehaviour With PropertyDrawer HOT 1
- Undo break dynamic output
- Default input and output parameters
- Is there a way to move port and parameter text locations?
- Undo will lose all group view ! HOT 3
- Nothing shows up in the context menu upon import.
- Is this project abandoned? HOT 15
- Calling `AddExposedParameter` in `BaseGraph.OnEnable` causes all ports and edges to disappear. HOT 3
- CustomPortBehavior from base class not respected.
- This asset causes large delays for entering playmode and recompiling assemblies
- Expanding Exposed Parameter Resets Name
- `FilterCreateNodeMenuEntries` Not working when I create Node by drag HOT 1
- I cant set the value in Parameter Window
- Huge GC alloc, sky high Cpu spikes, almost unusable at runtime
- 关于黑板变量赋值被锁定的问题
- Node in stack can't be dragged out and are stuck HOT 1
- Visual glitches on edges when they're bent at ~180 degrees HOT 1
- Leting user to edit graph in game mode
- ForNode can't work together with WaitNode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodegraphprocessor.