I have not written my own Unspawn node, I am using the one available in Unit Flow.
I have checked that both the world and the unit aren't nil, and both of them work in other places of my project.
Here is the callstack and error message from when I am calling
stingray.World.destroy_unit(stingray.Application.main_world(), unit)
in my inventory script.
Editor / General: Test Engine: Access violation (0xc0000005) in build e643650096712533ea0ade9e638eeb1d671fbb05
accessing address 00000000FABEFEBB from 00000001400947CE
Build identifier: `e643650096712533ea0ade9e638eeb1d671fbb05`
Product version: `Developer Build (1.7.0.0)`
Thread name: `main`
Error context
----------------------------------------
Flow callback: ProjectFlowCallbacks.AimedAtUnit
Callstack
----------------------------------------
0x4062ce74 d:\stingray\stingray\runtime\foundation\error\callstack_win.cpp(286): stingray::callstack::exception_call_stack
0x4062d430 d:\stingray\stingray\runtime\foundation\error\exception_handling_win.cpp(97): stingray::exceptions::exception_filter
0x4091f3de d:\stingray\stingray\runtime\main\windows\main.cpp(72): `safe_run'::`1'::filt$0
0x408adf58 __C_specific_handler
0x1589976d __chkstk
0x15824c19 RtlImageNtHeaderEx
0x1589887a KiUserExceptionDispatcher
0x400947ce d:\stingray\stingray\runtime\application\flow\flow.cpp(495): stingray::flow::trigger_in_event
0x4009d40d d:\stingray\stingray\runtime\application\flow\flow_nodes.cpp(125): stingray::flow_nodes::trigger_out_event
0x402e945d d:\stingray\stingray\runtime\application\flow\flow_nodes\script_flow_nodes.cpp(355): stingray::flow_nodes::script_nodes::custom_script_node_trigger
0x401da9a5 d:\stingray\stingray\runtime\application\flow\flow_nodes_registry.cpp(81): stingray::flow_nodes::registry::internal::trigger_callback
0x4009d3a4 d:\stingray\stingray\runtime\application\flow\flow_nodes.cpp(555): stingray::flow_nodes::trigger_in_event
0x400947d9 d:\stingray\stingray\runtime\application\flow\flow.cpp(496): stingray::flow::trigger_in_event
0x4020a72f d:\stingray\stingray\runtime\application\flow\flow_nodes_api.h(53): stingray::flow_nodes::api::trigger_out_event
0x402f0e88 d:\stingray\stingray\runtime\application\flow\flow_nodes\utility_flow_nodes.cpp(415): stingray::flow_nodes::utility_nodes::compare_objects_trigger
0x401da9a5 d:\stingray\stingray\runtime\application\flow\flow_nodes_registry.cpp(81): stingray::flow_nodes::registry::internal::trigger_callback
0x4009d3a4 d:\stingray\stingray\runtime\application\flow\flow_nodes.cpp(555): stingray::flow_nodes::trigger_in_event
0x400947d9 d:\stingray\stingray\runtime\application\flow\flow.cpp(496): stingray::flow::trigger_in_event
0x4020a72f d:\stingray\stingray\runtime\application\flow\flow_nodes_api.h(53): stingray::flow_nodes::api::trigger_out_event
0x402d7d7d d:\stingray\stingray\runtime\application\flow\flow_nodes\event_flow_nodes.cpp(49): stingray::flow_nodes::event_nodes::event_callback
0x401d9d57 d:\stingray\stingray\runtime\application\flow\flow_nodes_registry.cpp(99): stingray::flow_nodes::registry::internal::event_callback
0x4009d3b9 d:\stingray\stingray\runtime\application\flow\flow_nodes.cpp(593): stingray::flow_nodes::trigger_out_event
0x400948f8 d:\stingray\stingray\runtime\application\flow\flow.cpp(519): stingray::flow::trigger_out_event
0x4009466e d:\stingray\stingray\runtime\application\flow\flow.cpp(534): stingray::flow::trigger_external_event
0x401d6fc4 d:\stingray\stingray\runtime\application\flow\flow_switchboard.cpp(283): stingray::FlowSwitchboard::trigger_level_updates
0x403ed03f d:\stingray\stingray\runtime\application\script\interface\if_level.cpp(81): <lambda_a8a59b0f7c5b41e9e742074e845fd0a8>::operator()
0xeeaddcee lua_newstate
0xeea9456d lua_pcall
0x401b59c9 d:\stingray\stingray\runtime\application\script\lua_environment.cpp(687): stingray::LuaEnvironment::call
0x401b5c7b d:\stingray\stingray\runtime\application\script\lua_environment.cpp(1039): stingray::LuaEnvironment::call_global
0x4073d335 d:\stingray\stingray\runtime\game\game.cpp(466): `anonymous namespace'::MyGame::update
0x401a1f0c d:\stingray\stingray\runtime\application\application.cpp(3004): stingray::Application::update
System Information
----------------------------------------
--- CPU
CPU: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
Vendor: GenuineIntel
Logical processors: 8
Family: 0:6, Model: 5:14
Type: 0, Stepping: 3
Features: SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
Feature bits:
EBX: 00000000 00010000 00001000 00000000
ECX: 01111111 11111010 11111011 10111111
EDX: 10111111 11101011 11111011 11111111
--- OS
Windows version 6.2 build 9200
Windows 8
--- Graphics
Graphics card: NVIDIA GeForce GTX 980 Ti (DirectX 11.0)
Graphics card: Microsoft Basic Render Driver (DirectX 11.0)
--- Sound
No sound card detected.
--- Network
Network interface: Intel(R) Dual Band Wireless-AC 3165 (IPv4, IPv6)
Network interface: Microsoft Wi-Fi Direct Virtual Adapter (IPv4, IPv6)
Network interface: Realtek PCIe GBE Family Controller (IPv4, IPv6)
Network interface: Microsoft 6to4 Adapter (IPv6)
Network interface: Bluetooth Device (Personal Area Network) (IPv4, IPv6)
Network interface: Microsoft ISATAP Adapter #3 (IPv6)
--- Input
Input device: Mouse (18.1): Mouse
Input device: Keyboard (19.4): Keyboard
Input device: Generic (17.0): Razer Lycosa
Lua Stack
----------------------------------------
[0] [C]: in function trigger_level_update
[1] core/appkit/lua/level_wrapper.lua:80: in function update
[2] core/appkit/lua/app.lua:252: in function update
[3] core/appkit/lua/simple_project.lua:214:in function <core/appkit/lua/simple_project.lua:210>
Lua Locals
----------------------------------------
[1] self = table: 000000007ECD11C0, dt = 0.01667485386133194
[2] dt = 0.01667485386133194, managed = table: 000000007EC91458, _ = [Level], level_wrapper = table: 000000007ECD11C0
[3] dt = 0.01667485386133194
Editor / General: Testing failed. See logs. And here is the callstack when I call the Unspawn flow node via an external in event:
Editor / General: Test Engine: Access violation (0xc0000005) in build e643650096712533ea0ade9e638eeb1d671fbb05
accessing address 000000011581FEBB from 00000001400947CE
Build identifier: `e643650096712533ea0ade9e638eeb1d671fbb05`
Product version: `Developer Build (1.7.0.0)`
Thread name: `main`
Error context
----------------------------------------
Flow callback: ProjectFlowCallbacks.AimedAtUnit
Callstack
----------------------------------------
0x4062ce74 d:\stingray\stingray\runtime\foundation\error\callstack_win.cpp(286): stingray::callstack::exception_call_stack
0x4062d430 d:\stingray\stingray\runtime\foundation\error\exception_handling_win.cpp(97): stingray::exceptions::exception_filter
0x4091f3de d:\stingray\stingray\runtime\main\windows\main.cpp(72): `safe_run'::`1'::filt$0
0x408adf58 __C_specific_handler
0x1589976d __chkstk
0x15824c19 RtlImageNtHeaderEx
0x1589887a KiUserExceptionDispatcher
0x400947ce d:\stingray\stingray\runtime\application\flow\flow.cpp(495): stingray::flow::trigger_in_event
0x4009d40d d:\stingray\stingray\runtime\application\flow\flow_nodes.cpp(125): stingray::flow_nodes::trigger_out_event
0x402e945d d:\stingray\stingray\runtime\application\flow\flow_nodes\script_flow_nodes.cpp(355): stingray::flow_nodes::script_nodes::custom_script_node_trigger
0x401da9a5 d:\stingray\stingray\runtime\application\flow\flow_nodes_registry.cpp(81): stingray::flow_nodes::registry::internal::trigger_callback
0x4009d3a4 d:\stingray\stingray\runtime\application\flow\flow_nodes.cpp(555): stingray::flow_nodes::trigger_in_event
0x400947d9 d:\stingray\stingray\runtime\application\flow\flow.cpp(496): stingray::flow::trigger_in_event
0x4020a72f d:\stingray\stingray\runtime\application\flow\flow_nodes_api.h(53): stingray::flow_nodes::api::trigger_out_event
0x402f0e88 d:\stingray\stingray\runtime\application\flow\flow_nodes\utility_flow_nodes.cpp(415): stingray::flow_nodes::utility_nodes::compare_objects_trigger
0x401da9a5 d:\stingray\stingray\runtime\application\flow\flow_nodes_registry.cpp(81): stingray::flow_nodes::registry::internal::trigger_callback
0x4009d3a4 d:\stingray\stingray\runtime\application\flow\flow_nodes.cpp(555): stingray::flow_nodes::trigger_in_event
0x400947d9 d:\stingray\stingray\runtime\application\flow\flow.cpp(496): stingray::flow::trigger_in_event
0x4020a72f d:\stingray\stingray\runtime\application\flow\flow_nodes_api.h(53): stingray::flow_nodes::api::trigger_out_event
0x402d7d7d d:\stingray\stingray\runtime\application\flow\flow_nodes\event_flow_nodes.cpp(49): stingray::flow_nodes::event_nodes::event_callback
0x401d9d57 d:\stingray\stingray\runtime\application\flow\flow_nodes_registry.cpp(99): stingray::flow_nodes::registry::internal::event_callback
0x4009d3b9 d:\stingray\stingray\runtime\application\flow\flow_nodes.cpp(593): stingray::flow_nodes::trigger_out_event
0x400948f8 d:\stingray\stingray\runtime\application\flow\flow.cpp(519): stingray::flow::trigger_out_event
0x4009466e d:\stingray\stingray\runtime\application\flow\flow.cpp(534): stingray::flow::trigger_external_event
0x401d6fc4 d:\stingray\stingray\runtime\application\flow\flow_switchboard.cpp(283): stingray::FlowSwitchboard::trigger_level_updates
0x403ed03f d:\stingray\stingray\runtime\application\script\interface\if_level.cpp(81): <lambda_a8a59b0f7c5b41e9e742074e845fd0a8>::operator()
0xeeaddcee lua_newstate
0xeea9456d lua_pcall
0x401b59c9 d:\stingray\stingray\runtime\application\script\lua_environment.cpp(687): stingray::LuaEnvironment::call
0x401b5c7b d:\stingray\stingray\runtime\application\script\lua_environment.cpp(1039): stingray::LuaEnvironment::call_global
0x4073d335 d:\stingray\stingray\runtime\game\game.cpp(466): `anonymous namespace'::MyGame::update
0x401a1f0c d:\stingray\stingray\runtime\application\application.cpp(3004): stingray::Application::update
System Information
----------------------------------------
--- CPU
CPU: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
Vendor: GenuineIntel
Logical processors: 8
Family: 0:6, Model: 5:14
Type: 0, Stepping: 3
Features: SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
Feature bits:
EBX: 00000100 00010000 00001000 00000000
ECX: 01111111 11111010 11111011 10111111
EDX: 10111111 11101011 11111011 11111111
--- OS
Windows version 6.2 build 9200
Windows 8
--- Graphics
Graphics card: NVIDIA GeForce GTX 980 Ti (DirectX 11.0)
Graphics card: Microsoft Basic Render Driver (DirectX 11.0)
--- Sound
No sound card detected.
--- Network
Network interface: Intel(R) Dual Band Wireless-AC 3165 (IPv4, IPv6)
Network interface: Microsoft Wi-Fi Direct Virtual Adapter (IPv4, IPv6)
Network interface: Realtek PCIe GBE Family Controller (IPv4, IPv6)
Network interface: Microsoft 6to4 Adapter (IPv6)
Network interface: Bluetooth Device (Personal Area Network) (IPv4, IPv6)
Network interface: Microsoft ISATAP Adapter #3 (IPv6)
--- Input
Input device: Mouse (18.1): Mouse
Input device: Keyboard (19.4): Keyboard
Input device: Generic (17.0): Razer Lycosa
Lua Stack
----------------------------------------
[0] [C]: in function trigger_level_update
[1] core/appkit/lua/level_wrapper.lua:80: in function update
[2] core/appkit/lua/app.lua:252: in function update
[3] core/appkit/lua/simple_project.lua:214:in function <core/appkit/lua/simple_project.lua:210>
Lua Locals
----------------------------------------
[1] self = table: 000000007ECD11C8, dt = 0.016684051603078842
[2] dt = 0.016684051603078842, managed = table: 000000007EC60BE0, _ = [Level], level_wrapper = table: 000000007ECD11C8
[3] dt = 0.016684051603078842
Editor / General: Testing failed. See logs.