Home | Documentation | Atomic Chat | Github

Application crashing without reason


Hello again guys.:slight_smile:
Today i got a little strange problem with my project. Every time when i try to manipulate custom component (methods, functions, setting up public variables, or even REMOVE THIS DAMN COMPONENT:rage:, etc…) on some Node (for example it could be a node with a simple physical prop (StaticModel + RidigBody + CollisionShape) that i created on scene and just added CSComponent with my custom component).
Node is exist when i try to do something with component, but for some unknown reason it just cancelling the work with reason “Project.exe stoped working, wait or do something, blah, blah, blah”.
Does anybody know why this happening ?


That does sound odd. Try regenerating the solution, from the Developer Menu -> Plugins -> AtomicNET -> Generate Solution and see if that makes the bad behavior stop.
If not, try a different project to see if it does the same thing.


Hello, You can open the project in Visual Studio by clicking on any C# source file in it. You should then be able to run under the debugger. Once the app crashes, can you paste your callstack here?


Might be i’m doing something wrong, but VS saying that debug cannot be run, because project create .dll file. I know, in compile log we have an .exe file, but it i dont know.


You need to switch the startup project to be the executable project in the solution. In Visual Studio, this currently isn’t the default in the generated solution, and I have filed an issue to make it so: https://github.com/AtomicGameEngine/AtomicGameEngine/issues/1380


Example how this problem :
(yes, i know some of the content inside is on russian, but i think all understandable by picture)

You can see, the scene contain the Node that is have custom class, but the system see it all like “null”…


Thanks for posting the gif, I don’t think I have ever tried to read code in one before. It might be better to paste relevant snippets as a bit difficult to follow :slight_smile:

I am thinking maybe OtherNode isn’t referencing the proper node from the scene? Can you verify the node with the name?


“prop_physics” component file (prop_physics.cs)

public class Prop_physics : CSComponent

public float health;
public float maxhealth;

void Update()
    if (health >= 0)

void Start()
    maxhealth = 100;
health = 100;
    var caches = GetSubsystem<ResourceCache>();
    var modelNode = Scene.CreateChild("prop_physics");

    modelNode.Position = Node.Position;
    modelNode.Rotation = Node.Rotation;


And the “bullet” (or just other basic physical object that simulate the collision with other Nodes), (bullet.cs)

public class bullet : CSComponent
In Application, player is trowing “bullet” component, that is simmulate a

    bullet object that interact with all other nodes or bodies by collision.


bool IsAlive = true;

void SubscribeEvents()
    SubscribeToEvent<NodeCollisionEvent>(Node, HandleNodeCollision);

void Update(float timeStep)
    if (IsAlive == false)

void Start()

void HandleNodeCollision(NodeCollisionEvent e)
    RigidBody otherBody = e.OtherBody;
    var cache = GetSubsystem<ResourceCache>();

    if (otherBody.Mass > 0.0f)

        // if (e.OtherNode.HasComponent("Prop_physics"))
        e.OtherNode.GetComponent<Prop_physics>().health = 0;

        So, when it try to interact with my custom component it just saying that
        component isn't exist or null.

        How is it posible ?

        Where is my mistake ?

        if (e.OtherNode.Name == "Crate")


So, when the bullet collide with some node it crashing and saying that e.OtherNode.GetComponent<Prop_physics>().health = 0; is null. But why? On GIF you can see we have created a component…


Have you solved this problem?

I had crashing too but I didnt locate the reason and simply cleaned and rebuild the solution which worked. But it seems like your reference to the object colliding is actually pointing to a null. It could be the startup problem or the part where you initialize e.otherbody (that other body might not have a rigidbody component) or try health = 100; before start() method. . .?