This article is aiming to provide a guide to instantiate a Godot scene from another scene. A typical use case of this can be shooting bullets. In this case, we instantiate bullets of the Bullet scene from the Player scene. I will be using gdnative 0.9.3 and rustc 1.50.0.

Bullet Scene

First, let’s consider the Bullet scene. In the below example, I am using a KinematicBody2D node as the root node. Let's give it some properties so that when we create a bullet, it will move towards the positive x-direction.

use gdnative::prelude::*;

#[derive(NativeClass)]
#[inherit(KinematicBody2D)]
pub struct Bullet {
acceleration: f32…

Tharindu Wickramage Don

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store