Godot4アドオンをGitサブモジュールで配置した際の警告メッセージの対処例

無料・軽快な 2D/3D ゲームエンジン GodotEngine4 の機能を拡張するアドオンを、自身のプロジェクトフォルダに Git サブモジュールとして配置して、そのアドオンのフォルダへのシンボリックリンクを、プロジェクトフォルダの addons フォルダに作成した後に、エディタでプロジェクトを開くと表示された invalid UID の警告と、その対処例を紹介します。

この記事で紹介する警告は、筆者のミスで起こったものです。 Gut を Git サブモジュールとして追加したあとタグでバージョン(v9.4.0) を指定してチェックアウトすると警告もエラーも発生しませんでした。
チェックアウトを含む導入は、以下の記事を参照してください。

GodotEngine4.3 公式サイトの一部 20240911

※ GodotEngine のバージョンは v4.3.stable.official [77dcf97d8] です。
※ Gut のバージョンは 9.4.0 です。

注意とおことわり

以降で記載している警告は、筆者のミスで発生したものです。Gut (v9.4.0) に問題はありません。サブモジュールを追加しただけでは、現行の開発中のファイルが作業ディレクトリに作成されるために起きたと考えられます。サブモジュールの追加後バージョンをタグで指定してサブモジュールをチェックアウトすると警告は発生しません。

Gut (v9.4.0) を Git サブモジュールとして追加して、バージョンをタグで指定して、利用する手順については以下の記事を参照してください。

以降は、 GodotEngine4 invaid UID の警告への対処例としてだけお読みください。

警告が発生した経緯

前回までに、GodotEngine4 のユニットテスト用アセット Gut を GitHub のリポジトリから Git サブモジュールとして プロジェクトフォルダの third_party\Gut\ に配置して、 addons\ に third_party\Gut\addons\gut\ のディレクトリ用シンボリックリンク gut を作成しました。

その後、GodotEngine4 のエディタでプロジェクトを開くと、以下のように Gut アドオンのシーンファイル (.tscn) で invalid UID が発生したことの警告文が表示されました。
※これは Gut アドオンに限らず、 GodotEngine のプロジェクトを公開した Git リポジトリをサブモジュールとして自身のプロジェクトに外部プロジェクトを配置した場合に起きる現象と思います。

Godot Gut アドオン(Gitサブモジュール版)のシーンの Invalid UID 警告の対処例1
  editor/editor_file_system.cpp:2828 - Detected another project.godot at res://third_party/Gut. The folder will be ignored.
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/GutBottomPanel.tscn:3 - ext_resource, invalid UID: uid://dtvnb0xatk0my - using text path instead: res://addons/gut/gui/GutBottomPanel.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/ShortcutButton.tscn:3 - ext_resource, invalid UID: uid://k6hvvpekp0xw - using text path instead: res://addons/gut/gui/ShortcutButton.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/BottomPanelShortcuts.tscn:4 - ext_resource, invalid UID: uid://vppa8r8uq548 - using text path instead: res://addons/gut/gui/BottomPanelShortcuts.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/RunAtCursor.tscn:3 - ext_resource, invalid UID: uid://c4gmgdl1xwflw - using text path instead: res://addons/gut/gui/RunAtCursor.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/RunResults.tscn:3 - ext_resource, invalid UID: uid://chnko3073tkcv - using text path instead: res://addons/gut/gui/RunResults.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/ResultsTree.tscn:3 - ext_resource, invalid UID: uid://dehdhn78qv5tr - using text path instead: res://addons/gut/gui/ResultsTree.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/GutScene.tscn:3 - ext_resource, invalid UID: uid://bw7tukh738kw1 - using text path instead: res://addons/gut/GutScene.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/NormalGui.tscn:4 - ext_resource, invalid UID: uid://blvhsbnsvfyow - using text path instead: res://addons/gut/gui/gut_gui.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/ResizeHandle.tscn:3 - ext_resource, invalid UID: uid://duf6rfdqr6yoc - using text path instead: res://addons/gut/gui/ResizeHandle.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/MinGui.tscn:5 - ext_resource, invalid UID: uid://blvhsbnsvfyow - using text path instead: res://addons/gut/gui/gut_gui.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/GutBottomPanel.tscn:3 - ext_resource, invalid UID: uid://dtvnb0xatk0my - using text path instead: res://addons/gut/gui/GutBottomPanel.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/RunAtCursor.tscn:3 - ext_resource, invalid UID: uid://c4gmgdl1xwflw - using text path instead: res://addons/gut/gui/RunAtCursor.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/RunResults.tscn:3 - ext_resource, invalid UID: uid://chnko3073tkcv - using text path instead: res://addons/gut/gui/RunResults.gd
  scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/BottomPanelShortcuts.tscn:4 - ext_resource, invalid UID: uid://vppa8r8uq548 - using text path instead: res://addons/gut/gui/BottomPanelShortcuts.gd

警告文は表示されますが、 GUT ボトムパネルは表示されていて、選択するとそのパネルも正常に表示されました。

Godot Gut アドオン(Gitサブモジュール版)のシーンの Invalid UID 警告の対処例2
scene/resources/resource_format_text.cpp:453 - res://addons/gut/gui/GutBottomPanel.tscn:3 - ext_resource, invalid UID: uid://dtvnb0xatk0my - using text path instead: res://addons/gut/gui/GutBottomPanel.gd

上記のような UID が無効であることを表す警告文が、複数のシーンファイル (.tscn) から発せられました。
この警告は、エディタでリソースに自動的に割り振った UID と、別の環境で作られたシーンファイル内の UID が一致しないために起きる現象かもしれません。

Godot 4.4では、リソースの一意識別子であるUID(Unique Identifier)が導入されました。​これにより、スクリプトやシェーダーなどのリソースを移動・リネームしても、参照が保持されるようになりました。​UIDはuid://スキームを使用してリソースを参照します。

Godot 4.4 UID機能チュートリアル | GODOT TUTORIAL

これに対処する簡単な方法は、そのシーンを開いて何もせずに上書き保存することです。
※シーンを開く際は、警告文の .tscn ファイルの名前をコピーして、ファイルシステムドック上部の検索ボックス貼り付けると探しやすかったです。

Godot Gut アドオン(Gitサブモジュール版)のシーンの Invalid UID 警告の対処例3

I don’t commit my import files. When I checkout a repository fresh, this error appears thousands of times in the logs. How do we resolve this?

インポートファイルをコミットしません。リポジトリを新しくチェックアウトすると、このエラーがログに何千回も表示されます。これをどうやって解決すればいいのでしょうか?

I resolved it by just opening up the impacted scenes and saving them again. Later I saw there was a “Save All Scenes” option in the File Menu. I’m not sure if it also fixes this problem without reopening each one but worth trying.

影響を受けたシーンを開いて再度保存するだけで解決しました。後で、ファイルメニューに「すべてのシーンを保存」オプションがあることに気づきました。それぞれを再度開かなくてもこの問題が解決するかどうかはわかりませんが、試してみる価値はあります。

How do you resolve “ext_resource, invalid UID … “using text path instead” in Godot 4? : r/godot と Google 翻訳

インポートファイルをコミットしないんだよね。リポジトリをクリーンにチェックアウトすると、このエラーがログに何千回も表示されるんだ。これ、どうやって解決するの?

問題は、影響のあるシーンを開いて、もう一度保存するだけで解決しました。

Godot 4 で “ext_resource, invalid UID … “text path を代わりに使う” をどうやって解決するの? : r/godot

これにより、.tscn ファイル内の無効な UID が削除され、そのリソースを指すパスだけが残りました。

-[ext_resource type="Script" uid="uid://dtvnb0xatk0my" path="res://addons/gut/gui/GutBottomPanel.gd" id="1"]
+[ext_resource type="Script" path="res://addons/gut/gui/GutBottomPanel.gd" id="1"]

また、サブリソースの ID は、自身のプロジェクト内でエディタが新たに割り振られた ID に変更されたようです。

Godot Gut アドオン(Gitサブモジュール版)のシーンの Invalid UID 警告の対処例6_1
diff --git "a/addons/gut/gui/GutBottomPanel.tscn" "b/addons/gut/gui/GutBottomPanel.tscn"
index 1eb020f..c2a2abb 100644
--- "a/addons/gut/gui/GutBottomPanel.tscn"
+++ "b/addons/gut/gui/GutBottomPanel.tscn"
@@ -1,6 +1,6 @@
 [gd_scene load_steps=10 format=3 uid="uid://b3bostcslstem"]
 
-[ext_resource type="Script" uid="uid://dtvnb0xatk0my" path="res://addons/gut/gui/GutBottomPanel.gd" id="1"]
+[ext_resource type="Script" path="res://addons/gut/gui/GutBottomPanel.gd" id="1"]
 [ext_resource type="PackedScene" uid="uid://bsk32dh41b4gs" path="res://addons/gut/gui/BottomPanelShortcuts.tscn" id="2"]
 [ext_resource type="PackedScene" uid="uid://0yunjxtaa8iw" path="res://addons/gut/gui/RunAtCursor.tscn" id="3"]
 [ext_resource type="Texture2D" uid="uid://cr6tvdv0ve6cv" path="res://addons/gut/gui/play.png" id="4"]
@@ -9,7 +9,7 @@
 
 [sub_resource type="Shortcut" id="9"]
 
-[sub_resource type="Image" id="Image_p7oqn"]
+[sub_resource type="Image" id="Image_mdv6o"]
 data = {
 "data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
 "format": "RGBA8",
@@ -18,8 +18,8 @@ data = {
 "width": 16
 }
 
-[sub_resource type="ImageTexture" id="ImageTexture_umaha"]
-image = SubResource("Image_p7oqn")
+[sub_resource type="ImageTexture" id="ImageTexture_hchil"]
+image = SubResource("Image_mdv6o")
 
 [node name="GutBottomPanel" type="Control"]
 custom_minimum_size = Vector2(250, 250)
@@ -68,17 +68,20 @@ layout_mode = 2
 [node name="RunResultsBtn" type="Button" parent="layout/ControlBar"]
 layout_mode = 2
 toggle_mode = true
-icon = SubResource("ImageTexture_umaha")
+button_pressed = true
+icon = SubResource("ImageTexture_hchil")
 
 [node name="OutputBtn" type="Button" parent="layout/ControlBar"]
 layout_mode = 2
 toggle_mode = true
-icon = SubResource("ImageTexture_umaha")
+button_pressed = true
+icon = SubResource("ImageTexture_hchil")
 
 [node name="Settings" type="Button" parent="layout/ControlBar"]
 layout_mode = 2
 toggle_mode = true
-icon = SubResource("ImageTexture_umaha")
+button_pressed = true
+icon = SubResource("ImageTexture_hchil")
 
 [node name="Sep2" type="ColorRect" parent="layout/ControlBar"]
 custom_minimum_size = Vector2(1, 2.08165e-12)
@@ -87,24 +90,12 @@ layout_mode = 2
 [node name="Shortcuts" type="Button" parent="layout/ControlBar"]
 layout_mode = 2
 size_flags_vertical = 11
-icon = SubResource("ImageTexture_umaha")
+icon = SubResource("ImageTexture_hchil")
 
 [node name="RSplit" type="HSplitContainer" parent="layout"]
 layout_mode = 2
 size_flags_horizontal = 3
 size_flags_vertical = 3
-collapsed = true
-
-[node name="sc" type="ScrollContainer" parent="layout/RSplit"]
-visible = false
-custom_minimum_size = Vector2(500, 2.08165e-12)
-layout_mode = 2
-size_flags_vertical = 3
-
-[node name="Settings" type="VBoxContainer" parent="layout/RSplit/sc"]
-layout_mode = 2
-size_flags_horizontal = 3
-size_flags_vertical = 3
 
 [node name="CResults" type="VBoxContainer" parent="layout/RSplit"]
 layout_mode = 2
@@ -228,15 +219,24 @@ size_flags_horizontal = 3
 size_flags_vertical = 3
 
 [node name="RunResults" parent="layout/RSplit/CResults/TabBar" instance=ExtResource("5")]
-visible = false
+custom_minimum_size = Vector2(350, 0)
 layout_mode = 2
 size_flags_horizontal = 3
 size_flags_vertical = 3
 
 [node name="OutputText" parent="layout/RSplit/CResults/TabBar" instance=ExtResource("6")]
-visible = false
 layout_mode = 2
 
+[node name="sc" type="ScrollContainer" parent="layout/RSplit"]
+custom_minimum_size = Vector2(500, 2.08165e-12)
+layout_mode = 2
+size_flags_vertical = 3
+
+[node name="Settings" type="VBoxContainer" parent="layout/RSplit/sc"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 3
+
 [node name="BottomPanelShortcuts" parent="." instance=ExtResource("2")]
 visible = false
 

試しに警告文の1つのシーンファイルを開いて上書き保存した後に、エディタを再起動する(プロジェクトを開きなおす)と、そのシーンファイルの invalid UID の警告が消えました

Godot Gut アドオン(Gitサブモジュール版)のシーンの Invalid UID 警告の対処例4

これを全ての invalid UID が発生しているシーンファイル (.tscn) の警告に対して行います。

Godot Gut アドオン(Gitサブモジュール版)のシーンの Invalid UID 警告の対処例5

エディタを再起動すると、各シーンの invalid UID の警告が全て消えました

Godot Gut アドオン(Gitサブモジュール版)のシーンの Invalid UID 警告の対処例6

まとめ

今回は、無料・軽快な 2D/3D ゲームエンジン GodotEngine4 の機能を拡張するアドオンを、自身のプロジェクトフォルダに Git サブモジュールとして配置して、そのアドオンのフォルダへのシンボリックリンクを、プロジェクトフォルダの addons フォルダに作成した後に、エディタでプロジェクトを開くと表示された invalid UID の警告と、その対処例を紹介しました。

参照サイト Thank You!

記事一覧 → Compota-Soft-Press

コメント

Ads Blocker Image Powered by Code Help Pro

お願い - Ads Blocker Detected

このサイトは広告を掲載して運営しています。

ポップアップを閉じて閲覧できますが、よろしければ

このサイト内の広告を非表示にする拡張機能をオフにしていただけませんか?

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

タイトルとURLをコピーしました