Skip to content

Fix for GridSensor3D Warning: Cannot pass 1 as Enum "BaseMaterial3D.Transparency" - #61

Open
Ivan-267 wants to merge 1 commit into
mainfrom
Ivan-267-patch-3
Open

Fix for GridSensor3D Warning: Cannot pass 1 as Enum "BaseMaterial3D.Transparency"#61
Ivan-267 wants to merge 1 commit into
mainfrom
Ivan-267-patch-3

Conversation

@Ivan-267

@Ivan-267 Ivan-267 commented Mar 21, 2026

Copy link
Copy Markdown
Collaborator

Fixes the following warning by replacing the integer with the enum:

W 0:00:00:559   GDScript::reload: Cannot pass 1 as Enum "BaseMaterial3D.Transparency": no enum member has matching value.
  <GDScript Error>INT_AS_ENUM_WITHOUT_MATCH
  <GDScript Source>GridSensorStaticOnly3D.gd:100 @ GDScript::reload()

Checked with Godot 4.6.1.

Note: Filename in warning log doesn't match as I got the warning on a locally modified sensor with a different filename, but otherwise the fix matches.

@Ivan-267
Ivan-267 requested a review from edbeeching March 21, 2026 07:18
@Ivan-267

Copy link
Copy Markdown
Collaborator Author

@edbeeching could you approve this one so that I can merge it?

@stefanfausser

Copy link
Copy Markdown
Contributor

Interestingly, I do not get above warning. According to the documentation, the enum BaseMaterial3D.Transparency.TRANSPARENCY_ALPHA matches int number 1, see https://docs.godotengine.org/en/stable/classes/class_basematerial3d.html#enum-basematerial3d-transparency.

However, it is always better to use enums instead of numbers so for me this fix would be clean and good.

@Ivan-267

Ivan-267 commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator Author

Interestingly, I do not get above warning. According to the documentation, the enum BaseMaterial3D.Transparency.TRANSPARENCY_ALPHA matches int number 1, see https://docs.godotengine.org/en/stable/classes/class_basematerial3d.html#enum-basematerial3d-transparency.

However, it is always better to use enums instead of numbers so for me this fix would be clean and good.

I don't quite remember the exact scenario where I got it, but probably it happens when the sensor is used. For example I'm not getting the warning in Godot 4.6.3 when not using the sensor.

It's also possible that the warning might not show up in different Godot versions, but even if the warning stopped showing up we can still apply the change.

@stefanfausser

Copy link
Copy Markdown
Contributor

but even if the warning stopped showing up we can still apply the change.

Agreed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants