Skip to content
Discussion options

You must be logged in to vote

You actually need to add Res<Assets<MyAsset>> to your system. Then you can take it and call assets.get(&handle).

How to do that? I thought .add_system only for function.

I mean add it to your function params:

fn my_system(query: Query<(&mut Transform, &Handle<Image>)>, assets: Res<Assets<Image>>) {
  // ...
}

But I don't know what value to pass in Assets::get first argument, what is the value should?

I see, so if the first param &self (lower case S), it mean the instance which called. So I can't use Assets::get() directly. I need to use an instance to call get right?

that's why you use 'assets.get(&handle)' because assets is the instance and the second param filled with first argum…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@MrGVSV
Comment options

MrGVSV Jun 30, 2023
Collaborator

Answer selected by Moanrisy
@Moanrisy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants