Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | potatobanana |
why my color being overwrite by other instance?
i instance two player with different color palette , but both of my player follow second player color palette.
why my color being overwrite by other instance?
when i just change modulate color like this
$basic.set_modulate(Color(ColorN(test_color)))
it work.
but when i change palette color $basic.material.set_shader_param("pallete",load(PlayerGlobalStat.color_p_d[str(skin_color)].path))
newplayer2
keep overwrite newplayer
skin color.
spawn room
var player = preload("res://scene/player/player.tscn")
func _ready() -> void:
var newplayer = player.instance()
get_node("creation").add_child(newplayer)
newplayer.global_position = get_node("slection_Panel/VBoxContainer/character_checkbox/player_slot1/player_slot_pos").global_position
newplayer.skin_color = str(1)
var newplayer2 = player.instance()
get_node("creation").add_child(newplayer2)
newplayer2.global_position = get_node("slection_Panel/VBoxContainer/character_checkbox/player_slot2/player_slot_pos").global_position
newplayer2.skin_color = str(4)
player
var skin_color
func _ready() -> void:
skin_color= 1
func _process(delta: float) -> void:
$basic.material.set_shader_param("pallete",load(PlayerGlobalStat.color_p_d[str(skin_color)].path))