-
Notifications
You must be signed in to change notification settings - Fork 541
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
LODIndexFence #2330
base: master
Are you sure you want to change the base?
LODIndexFence #2330
Conversation
What exactly are you doing to cause the issue this is trying to fix? This doesn't seem like a good solution.. |
model.Model.GetBox(Transform.Identity); when is called in OnAwake is has chanse to crash the engine even if index provided is valid but model is not ready yet also if provided LOD index is out of range it will also crash |
The correct way to access any asset data is to ensure it has been loaded - Content load task might modify the asset before so code that doesn't check might fail due to memory/threading issues. Use |
i will try it if it fails i will follow up |
added time span printing
I'm still not sure what the point of the |
there is not cheeks casualty saying u need to use WaitFor Loaded unless u know why this is happening remember some devs are beginners and might just keep crashing the engine one of the rules of software engineering is don't trust user input |
I'm not sure how using an engine provided function to handle waiting for engine provided asset loading is trusting user input lol (unless I'm misunderstanding something you said) And yes you shouldn't allow access to an invalid index, that's what calling the |
in this case it will say it cant load it so asset missing or something else is wrong other aprouthe is just to throw a error and, let the user deal with it |
Yes, WaitForLoaded() will complain if it can't load the asset. This is normal behavior and should be standardized across the engine. If you don't like how that error is reported, you can change it (in a separate PR preferrably). The asset failing to load is independent of handling the model LOD indices. I suggest simply adding |
fixes 2 cases
case 1 index was invalid
case 2 model was not ready for use
this this case the code with wait it will print a information about this
it not always triggered looks like it is something to do with async loading of the asset its 90% time triggering when model is first loaded and is not existing the the scene
awaiting time is dependent on model complexity