0 votes

I have two different material, but I am not sure how to load the material(*.material) inside the CSGBox script. I couldn't find a good example to do it.

Godot version 3.4.2
in Engine by (82 points)

Is this ?
$CSGbox.getsurfacematerial(0)

Maybe this
https://godotengine.org/qa/3488/how-to-generate-a-mesh-with-multiple-materials

Thank you so much for your reply!

getsurfacematerial(0) returns error:

but set_material(material) worked!

I actually had another way that worked for me

I was going to update the answer but you beat me at it!

So what I did was:
onready var selected = preload("res://selected.material")

and in the function:
material = selected

I'm marking your answer as a correct as it seems more standard and professional answer than mine!

Ah, feel free to post as an answer. Yours worked

The important thing is to solve problem. Good evening!

1 Answer

+1 vote
Best answer

$CSGbox.getsurfacematerial(0)

https://godotengine.org/qa/3488/how-to-generate-a-mesh-with-multiple-materials

by [kakcalu13 ]
getsurfacematerial(0) returns error:
but set_material(material) worked!

by (755 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.