Hi, folks! So, I have the problem with making materials as unique.
I need effects, such as painting of ships in red color, will applies only where particles will spawns. But… As you can see those effects can applies also into other ships.
I’ve already set these materials as “Local to Scene” into inspector tab.
And have create script for making those materials as unique:
func _make_ship_materials_unique() -> void:
for i in ship.get_children():
if i is MeshInstance3D:
for n in range(i.get_surface_override_material_count()):
i.mesh.surface_set_material(n, i.mesh.surface_get_material(n).duplicate(true))
But it given me few results 😕
If it can help, here’s the script of applying of ships painting:
func damaged_spec_effect() -> void:
for i in ship.get_children():
if i is MeshInstance3D:
for n in range(i.get_surface_override_material_count()):
_create_fade_in_then_out_effect(i.mesh.surface_get_material(n), Color.RED)
func _create_fade_in_then_out_effect(material: Material, final_color: Color) -> void:
if material is StandardMaterial3D:
material.albedo_color = Color.WHITE
var tween = get_tree().create_tween()
tween.tween_property(material, "albedo_color", final_color, EFFECTS_DURATION / 2)
tween.tween_property(material, "albedo_color", Color.WHITE, EFFECTS_DURATION / 2)
So, what do I need to do for solving my problem? 🤔
Just out of curiosity is 1. really necessary? What happens if you only do 2. ?