Skip to content

Conversation

@Joy-less
Copy link
Contributor

@Joy-less Joy-less commented Dec 9, 2025

This is useful if you want to connect your own tool script to modify the material after it's generated.

@98teg
Copy link
Owner

98teg commented Dec 15, 2025

Not sure of the use case of this one, could you provide an example?

@Joy-less
Copy link
Contributor Author

Not sure of the use case of this one, could you provide an example?

In my own project, I created a wrapper tool script that further customises the SpriteMesh on top of what customization the SpriteMesh is able to provide.

SpriteMeshInstance.Connect(StringName("on_generated_sprite_mesh"), Callable.From(CustomizeMaterial));
public void CustomizeMaterial() {
    StandardMaterial3D StandardMaterial = (StandardMaterial3D)SpriteMeshInstance.GetSurfaceOverrideMaterial(0);
    StandardMaterial.DiffuseMode = BaseMaterial3D.DiffuseModeEnum.Toon;
    StandardMaterial.SpecularMode = BaseMaterial3D.SpecularModeEnum.Toon;
    StandardMaterial.RimEnabled = true;
    StandardMaterial.Rim = 1.0f;
}

Since the SpriteMesh is generated after a delay, it's not simple to do this without a signal.

@98teg
Copy link
Owner

98teg commented Jan 5, 2026

I think this should be at inside
func _generate_sprite_mesh()

@Joy-less
Copy link
Contributor Author

Joy-less commented Jan 5, 2026

I think this should be at inside func _generate_sprite_mesh()

You are right, unfortunately C# classes can't extend GDScript classes.

@98teg
Copy link
Owner

98teg commented Jan 6, 2026

I meant that the emitted signal should be inside func _generate_sprite_mesh() in order for this change to be merged, sorry for the confusion

@Joy-less Joy-less closed this Jan 6, 2026
@Joy-less Joy-less force-pushed the add-generated-signal branch from 19a8f20 to ede6b57 Compare January 6, 2026 15:15
@Joy-less
Copy link
Contributor Author

Joy-less commented Jan 6, 2026

Sorry, GitHub made a mess out of this.
I will open a new pull request.

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