How to get RigidBody in scripts ?like photo

i use Actor.TryGetScript(out rigid);.
but fail.

In this case, an Rigid body is not a script but it is an actor. Because your script is on your rigid body actor, in c# you could simply cast the actor to a rigid body like using something like var rigidbody = Actor as RigidBody in your script to get the actor as a rigid body.

2 Likes

If you just want a rigidbody reference like you show in the image, then you can just add

        [Serialize, ShowInEditor]
        private RigidBody rigid;

in the class definition of the script, before you define the methods.

1 Like

THANKS,I will try;