Skip to content

Conversation

Copy link

Copilot AI commented Oct 2, 2025

Problem

When creating a new project in OvEditor, users would encounter an assertion error:

[ASSERT] Attempting to SetProperty on a non-existing property

This caused the editor to display a white screen and prevented normal project creation.

Root Cause

The issue occurred during material deserialization in OvCore::Resources::Material::OnDeserialize(). The deserialization process:

  1. Loads the shader and calls SetShader() to populate material properties from shader uniforms
  2. Attempts to restore saved property values from the material file using SetProperty()

The SetProperty() method has an assertion that fails if the property doesn't exist. This can happen when:

  • The shader definition has changed and removed certain uniforms
  • The shader hasn't fully loaded its variants yet during initialization
  • Material files contain legacy properties from older shader versions

Solution

Replaced all SetProperty() calls with TrySetProperty() in the deserialization visitor. The TrySetProperty() method:

  • Checks if the property exists before attempting to set it
  • Returns true if successful, false if the property doesn't exist
  • Does not trigger assertions for missing properties

This provides graceful handling of property mismatches between serialized materials and their current shaders, which is expected behavior during version updates or shader changes.

Changes

  • Modified: Sources/Overload/OvCore/src/OvCore/Resources/Material.cpp
    • Lines 183, 187, 191, 195, 199, 203, 207: Changed SetProperty() to TrySetProperty()

This is a minimal, defensive fix that maintains backwards compatibility while preventing assertions during normal editor operations.

Fixes #<issue_number>

Original prompt

This section details on the original issue you should resolve

<issue_title>[ASSERT] Attempting to SetProperty on a non-existing property</issue_title>
<issue_description>## Description
Reported on Discord:

https://discord.com/channels/622075717659656195/622076898880520195/1409044934442483793

To Reproduce

  1. Follow GitHub instructions for compiling Overload
  2. Run OvEditor
  3. Create a new project
  4. Notice the issue

Expected behavior

Shouldn't hit this assert.</issue_description>

<agent_instructions>From the user: "I went through the github instructions for compiling overload, compiled it, then created a new project, opened it and was met with a white screen"</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #603

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] [ASSERT] Attempting to SetProperty on a non-existing property Fix material deserialization assertion when creating new projects Oct 2, 2025
Copilot AI requested a review from adriengivry October 2, 2025 20:45
Copilot finished work on behalf of adriengivry October 2, 2025 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[ASSERT] Attempting to SetProperty on a non-existing property

2 participants