Repository: godot
Issue: GetViewport().GetCamera3D() returns instance of the script attached to camera in C#
Labels: documentation,topic:dotnet

### Godot version

4.1

### System information

Windows 10

### Issue description

I have a control script on Camera that allows me to move the camera. In another script i need to access the camera to do raycasting from mouse position. GetViewport().GetCamera3D() Tries ot return the instance of the moving scrip attached to the camera instead of returnign the Camera3D object that i need.
```

E 0:00:00:0872   :0 @ System.Object System.Runtime.CompilerServices.CastHelpers.ChkCastAny(System.Void* , System.Object ): System.InvalidCastException: Unable to cast object of type 'CameraController' to type 'Godot.Camera3D'.
  <C++ Error>    System.InvalidCastException
  <C++ Source>   :0 @ System.Object System.Runtime.CompilerServices.CastHelpers.ChkCastAny(System.Void* , System.Object )
  <Stack Trace>  :0 @ System.Object System.Runtime.CompilerServices.CastHelpers.ChkCastAny(System.Void* , System.Object )
                 VariantUtils.generic.cs:385 @ T Godot.NativeInterop.VariantUtils.ConvertTo<T >(Godot.NativeInterop.godot_variant& )
                 map_controller_ScriptProperties.generated.cs:14 @ Boolean map_controller.SetGodotClassPropertyValue(Godot.NativeInterop.godot_string_name& , Godot.NativeInterop.godot_variant& )
                 CSharpInstanceBridge.cs:57 @ Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Set(IntPtr , Godot.NativeInterop.godot_string_name* , Godot.NativeInterop.godot_variant* )
```

If i try changeing the variable type into CameraController then i get tha reverse error saying that im trying to convert Godot.Camera3D into CameraController.


Seems like the API for C# is a bit broken.
 


### Steps to reproduce

Step 1: Add Camera3D to the scene.
Step 2: Create some script that controls camera movement, make it extend Node3D.
Step 3: Create another Node with Script to the scene.
Step 4: Try to save result of GetViewPort().GetCamera3D() into a variablt Typed Camera3D.


```
public partial class CameraController : Node3D
{
	// Declare member variables here. Examples:
	// private int a = 2;
	// private string b = "text";

	[Export]
	private float camera_speed = 4;
	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
	}

  // Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{      
		Viewport viewport = GetViewport();
		Vector2 size = viewport.GetVisibleRect().Size;
		Vector2 mouse = viewport.GetMousePosition();

		Vector3 offset = Vector3.Zero;
		if(mouse.X < 25){
			offset.X = -1;
		}else if (mouse.X > size.X - 25){
			offset.X = 1;
		}

		if(mouse.Y < 25){
			offset.Y = 1;
		}else if (mouse.Y > size.Y - 25){
			offset.Y = -1;
		}

		Translate(offset * Convert.ToSingle(delta) * camera_speed);
	}
}
```

```
public partial class map_controller : Node3D
{
	[Export]
	private Camera3D camera {get; set;}

	// Declare member variables here. Examples:
	// private int a = 2;
	// private string b = "text";

	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
		camera = GetViewport().GetCamera3D(); //This line is causing the error
	}

	//  // Called every frame. 'delta' is the elapsed time since the previous frame.
  //  public override void _Process(double delta)
  //  {
  //  }

}
```

### Minimal reproduction project

"N/A"