Problem when loading a scene, after sharing through git

Godot Version

4.4.1

Question

` I am sharing a project with another developer through GitHub. Whenever either of us tries to merge our branches with our main ‘dev’ branch, major conflicts follow.
When merging with said branch, many scene are impossible to open in Godot, which shows the error "Error while parsing file ‘scene_name.tscn’

I don’t really understand parse errors.

This has happened while several scenes, and i can’t find information anywhere for a possible fix.

Here is a sample of the Output from Godot when trying to open ‘enemy.tscn’

Godot Engine v4.4.1.stable.official (c) 2007-present Juan Linietsky, Ariel Manzur & Godot Contributors.
--- Debug adapter server started on port 6006 ---
--- GDScript language server started on port 6005 ---
  ERROR: Cannot get class 'GitPlugin'.
  ERROR: Received a nullptr VCS extension instance during construction.
  WARNING: scene/resources/resource_format_text.cpp:447 - res://scenes/entities/Player/player.tscn:5 - ext_resource, invalid UID: uid://dgfgcmo40quhs - using text path instead: res://assets/img/player.png
  WARNING: scene/resources/resource_format_text.cpp:447 - res://scenes/entities/Enemy/enemy.tscn:4 - ext_resource, invalid UID: uid://t4uvgydq72h3 - using text path instead: res://assets/img/enemy.png
  ERROR: scene/resources/resource_format_text.cpp:282 - Parse Error: Parse error. [Resource file res://scenes/entities/Enemy/enemy.tscn:21]
  ERROR: Failed loading resource: res://scenes/entities/Enemy/enemy.tscn. Make sure resources have been imported by opening the project in the editor at least once.
  WARNING: scene/resources/resource_format_text.cpp:447 - res://scenes/entities/Entity/health_bar.tscn:3 - ext_resource, invalid UID: uid://cx3bfydpl4aai - using text path instead: res://assets/img/HPBarEmpty.png
  WARNING: scene/resources/resource_format_text.cpp:447 - res://scenes/entities/Entity/health_bar.tscn:4 - ext_resource, invalid UID: uid://dckhanirwkuu5 - using text path instead: res://assets/img/HPBarFull.png
  WARNING: scene/resources/resource_format_text.cpp:447 - res://scenes/entities/Enemy/enemy.tscn:4 - ext_resource, invalid UID: uid://t4uvgydq72h3 - using text path instead: res://assets/img/enemy.png
  ERROR: scene/resources/resource_format_text.cpp:282 - Parse Error: Parse error. [Resource file res://scenes/entities/Enemy/enemy.tscn:21]
  ERROR: Failed loading resource: res://scenes/entities/Enemy/enemy.tscn. Make sure resources have been imported by opening the project in the editor at least once.

`

Open up your enemy.tscn in a text editor and paste it to the forum, maybe there was a git merge you did not complete.

I did solve the merge conflicts in scenes, and the conflicts were between "uid"s
I’m not sure i solved them the right way.

[gd_scene load_steps=4 format=3 uid="uid://cu0yx02e25udx"]

[ext_resource type="Script" path="res://scenes/entities/Enemy/enemy.gd" id="1_uyd3w"]
[ext_resource type="Texture2D" uid="uid://t4uvgydq72h3" path="res://assets/img/enemy.png" id="2_3troi"]

[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_lnqxm"]

[node name="CharacterBody2D" type="CharacterBody2D"]
script = ExtResource("1_uyd3w")
health = null
damage = null
speed = null

[node name="temp" type="Sprite2D" parent="."]
texture = ExtResource("2_3troi")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CapsuleShape2D_lnqxm")

[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("2_l06wt")

Just delete the UID and it will recreate itself in the editor. The next time it happens, you accept your friend’s UID and the problem will go away.

1 Like

So every time this happens i need to open every file in text editor, delete UIDs and then reopen in Godot ?

Not if you do what I said in the second sentence.

Alternately, you can do this now:

  1. Open Git Bash
  2. type git status
  3. type git restore followed by a list of each path to each UID separated by a space.
  4. Do the merge again and accept his UIDs.

Ultimately you all need to have the same UIDs and this will all go away.

1 Like

Another option would be something like this, assuming you just merged in from the main branch on github:

git checkout origin/main <file list separated by spaces>

Also either of those commands you can run one at a time on each file affected.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.