stride icon indicating copy to clipboard operation
stride copied to clipboard

Content Loading Type Error

Open jonyfries opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe. If the content URL points to the wrong object type (e.g. model instead of prefab) the error reports that the "[c]ontent serializer can not be found." For a new developer with Stride it makes it sound like the issue is with the serialization of the object rather than with the generic type parameter used for the return type.

Describe the solution you'd like When the URL is to a valid object but the generic type provided is incorrect for the URL the error should state "The asset at the provided URL is not of the requested type."

Describe alternatives you've considered Once an individual user understands what the error message means they will likely be able to determine what the problem is with the current wording.

Additional context https://github.com/jonyfries/LoadContentTypeError

Here are some questions that can aid in the description of the feature request:

  • What are the usecases? Helping new developers understand errors thrown by the engine.
  • What kind of options/settings are expected/wanted? NA
  • What would the (pseudo) code look like? NA
  • Is the feature affecting behaviour in the editor? NA
    • if so: how should this look in the editor? NA
  • Is there a component or datastructure? NA
  • what kind of documentation is needed or needs to be updated? NA
  • Should there be an example project? NA

jonyfries avatar Mar 08 '24 16:03 jonyfries

Thanks to Eiderens help I added a new method for the conentmanager called TryGetLoadedAsset that returns true if the object is found and will output a null object instead of throwing. I also learned from Eideren that you can just use object as the type identifier and then validate the type manually as shown here

If you have anymore suggestions please let us know.

Doprez avatar May 19 '24 22:05 Doprez

I think this is issue is more about the fact that the url does exist, but does not point to an object of the type the user specified. So what we should do is change the exception to specify if it's the url or the type provided that's invalid

Eideren avatar May 20 '24 14:05 Eideren

Would the below be better? It seems like all the info is there its just worded weird so I changed the exception message.

image

Ignore the Stride.Rendering.ProceduralModels.ProceduralModelDescriptor I used a procedural model so it specifies the ProceduralModelDescriptor instead of Stride.Rendering.Model.

Doprez avatar May 20 '24 16:05 Doprez

Yep, looks good !

Eideren avatar May 20 '24 19:05 Eideren