#How to access a `Res` as a `Sres` in `impl AsBindGroup`

5 messages · Page 1 of 1 (latest)

proud vigil
#

Hi,

I have a resource, that is inserted and accessible in systems as Res<MyResource> but I need to access this resource when constructing a bind group in a impl AsBindGroup block and when using type Param = SRes<MyResource> in the AsBindGroup trait, this Resource is not present and the app crashes. I can access it as an option but it is never present when accessed from the unprepared_bind_group() function parameter, even when it is accessible in a "normal" system parameter.

How can I access this resource from this function?

Thanks

crisp vapor
#

Does your resource get extracted to the Render World?

proud vigil
#

No. Or at least I don't think so. I thought this might be related, so I added ExtractResource in the derives, but it did not helped.

crisp vapor
#

You need to also use the ExtractResourcePlugin or something like that. I don't entirely remember the name of it

proud vigil
#

Thank you, that fixed this issues (more others in front). That was actually kind of stupid of me not to see this in the doc, sorry.