Advertisement
Joshua_Blackmon

swapping 3D Materials

Oct 9th, 2021
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. extends MeshInstance
  2.  
  3. export (Material) var default_mat
  4. export (Material) var new_mat
  5.  
  6. # Called when the node enters the scene tree for the first time.
  7. func _ready():
  8. pass # Replace with function body.
  9.  
  10.  
  11. func _process(_delta):
  12. if Input.is_action_just_pressed("mouse_left"):
  13. if get("material/0") == default_mat:
  14. set_surface_material(0, new_mat)
  15. elif get("material/0") == new_mat:
  16. set_surface_material(0, default_mat)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement