@@ -216,7 +216,7 @@ struct EntityFactory {}
216
216
#[methods]
217
217
impl EntityFactory {
218
218
#[export]
219
- fn enemy (& self , _owner : & Object , name : String , health : f32 )
219
+ fn enemy (& self , _owner : & Reference , name : String , health : f32 )
220
220
-> Instance <Enemy , Unique > {
221
221
Enemy { name , health }. emplace ()
222
222
}
@@ -286,12 +286,12 @@ impl AnotherNativeScript {
286
286
. expect (" Failed to convert my_node variant to object" )
287
287
. assume_safe ()
288
288
};
289
-
289
+
290
290
// 2. Obtain a TInstance which gives access to the Rust object's data.
291
291
let my_node = my_node
292
292
. cast_instance :: <MyNode2D >()
293
293
. expect (" Failed to cast my_node object to instance" );
294
-
294
+
295
295
// 3. Map over the RefInstance to process the underlying user data.
296
296
my_node
297
297
. map (| my_node , _owner | {
@@ -390,7 +390,7 @@ You would need to use the following code.
390
390
#[no_constructor]
391
391
struct MyNode {
392
392
// late-initialization is modeled with Option
393
- // the Default derive will initialize both to None
393
+ // the Default derive will initialize both to None
394
394
node2d : Option <Ref <Node >>,
395
395
instance : Option <Ref <MyClass >>,
396
396
}
@@ -406,7 +406,7 @@ impl MyNode {
406
406
let node2d = unsafe { node2d . assume_safe () };
407
407
let node2d = node2d . cast :: <Node2D >();
408
408
self . node2d = Some (node2d . claim ());
409
-
409
+
410
410
// Get an existing child node that is a Rust class.
411
411
let instance = owner
412
412
. get_node (" MyClass" )
0 commit comments