Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set a StandardMaterial3D crash? #134

Closed
noideaforaccountname opened this issue Dec 22, 2024 · 2 comments · Fixed by #135
Closed

set a StandardMaterial3D crash? #134

noideaforaccountname opened this issue Dec 22, 2024 · 2 comments · Fixed by #135
Assignees
Labels
bug Something isn't working

Comments

@noideaforaccountname
Copy link

Hi, now CSGSphere3D work, thanks.
when i try to set a StandardMaterial3D looks like crash:

  let s: CSGSphere3D = instantiate CSGSphere3D
  let mat: GdRef[StandardMaterial3D] = instantiate StandardMaterial3D
  mat[].setAlbedo(color(0, 0, 0.9))
  s.material = mat as GdRef[Material]

i wrote this "as GdRef[..." like written in wiki, is is correct? it compiles without error.

merry christmas

@panno8M
Copy link
Member

panno8M commented Dec 22, 2024

Problem identified.

It started working when I created the material in the editor beforehand and loaded it, so it is probably a bug in the library.
It will take some time to determine the cause. I will share a snippet that loads the material, so please use that instead until we make progress:

let s : CSGSphere3D = instantiate CSGSphere3D
s.material = ResourceLoader.load("res://path/to/material.tres") as GdRef[Material]

And a Merry Christmas to you too :)

@panno8M panno8M self-assigned this Dec 22, 2024
@panno8M panno8M added the bug Something isn't working label Dec 22, 2024
panno8M pushed a commit that referenced this issue Dec 22, 2024
@panno8M
Copy link
Member

panno8M commented Dec 22, 2024

Fixed. The snippet you illustrated is available since 0.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants