ListIteratingSystem problem

40 ogledov
Preskoči na prvo neprebrano sporočilo

John Nyquist

neprebran,
31. jan. 2015, 16:55:4731. 1. 15
do ash-fr...@googlegroups.com
I have a problem with a ListIteratingSystem I added. Ash is trying to call it's update node function, but failing because the node list is empty. At start, their are no instances of components that are used by the nodes that this system is using.

I'm not having a problem with other ListIteratingSystems in my project, so I'm wondering if I'm misunderstanding something about how Ash works. 

In the meantime, I've converted it to a regular System and that's working fine. 

Eric Lund

neprebran,
1. feb. 2015, 15:20:521. 2. 15
do ash-fr...@googlegroups.com
The ListIteratingSystem is doing exactly what it's supposed to do: it calls your nodeUpdatingFunction for each entity that matches the nodeClass when the system is updated. If no matching entities exist, the function is not called. So if there are 10 entities that match, your nodeUpdatingFunction will be called ten times, each time passed the relevant node object. It's saving you from having to call getNodeList() and looping over the results. Does that help?

John Nyquist

neprebran,
1. feb. 2015, 17:51:481. 2. 15
do ash-fr...@googlegroups.com
I was not clear in my description. When I said it is "failing", I meant that it is crashing with a null pointer. 

Eric Lund

neprebran,
2. feb. 2015, 11:08:432. 2. 15
do ash-fr...@googlegroups.com
Hrm. The source for ListIteratingSystem on AS3 is over here, which looks relatively straight-forward. I use the Haxe port, so I don't know how much I can help you troubleshoot this problem. You may want to open an issue. I recommend you post the exact error message with the stack trace. Is it possible you are passing a null value for any of the constructor parameters?

I spend most of my time with the Haxe port, so someone else who uses the 

John Nyquist

neprebran,
2. feb. 2015, 13:29:592. 2. 15
do ash-fr...@googlegroups.com
You're right, I should've grabbed the stacktrace and posted it it. I had posted my question, and then continued on since using System was working for me. If I remember correctly, the error was occurring in the the NodePool get(), but the call stemmed from the ListIteratingSystem. It seemed to not like the Node subclass I made. When I switched to using a System and grabbing a NodeList of that Node subclass, things worked fine. If I have time and can re-create the issue with a small example, I'll open an issue. In the meantime, I'm going to assume it was user-error  :-)  
Odgovori vsem
Odgovori avtorju
Posreduj
0 novih sporočil