Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | VirgilusGalacticus |
Hi,
I have strange behaviour when I want to get the type of my resource.
Here is the code where I use a list of my resource :
public void Build(List<CraftRecipe> recipeList){
foreach(CraftRecipe recipe in recipeList){
GD.Print("The recipe type is : "+recipe.GetType());
GD.Print("The craft Recipe type is : "+ typeof(CraftRecipe));
}
}
And it return to me this :
The recipe type is : ItemResource
The craft Recipe type is : CraftRecipe
PS: the “ItemResource” is another resource that I use in my project (it’s one of the CraftRecipe’s properties).
I’ve tried with others resources :
foreach(CraftRecipe recipe in recipeList){
GD.Print("The recipe type is : "+recipe.GetType());
GD.Print("The craft Recipe type is : "+ typeof(CraftRecipe));
GD.Print("The recipe itemResource type is : "+recipe.ItemResource.GetType());
GD.Print("The ItemResource type is : "+ typeof(ItemResource));
}
And there is the result :
The recipe type is : ItemResource
The craft Recipe type is : CraftRecipe
The recipe itemResource type is : Godot.StreamTexture
The ItemResource type is : ItemResource
Thanks for your answers.