Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

RaycastHit.textureCoord always (0,0) in standalone if fbx model Read/Write not enable

Discussion in 'Editor & General Support' started by kutawei, May 13, 2021.

  1. kutawei

    kutawei

    Joined:
    Apr 17, 2018
    Posts:
    1
    I encountered something weird. I developed on PC Win10 Unity Personal. I use Physics.Raycast to get the UV coordinate of the hit point. everything just fine in editor play mode. when I build the project, running standalone can't get the right UV coordinate, RaycastHit.textureCoord always return (0,0) when hit actually happens, RaycastHit.point and other value were as good as in editor except UV coordinate. I checked my code and build settings, not the reason. I also tested in different versions of Unity, 2019.4.12, 2019.4.26, 2020.3.7, the same problems. I searched internet no luck. After 2 days of struggle, I found the key,when I turn on the Read/Write Enable options on the target fbx, standalone get the correct UV finally.
    I want to report this to other people for saving their time. If this is not a bug, Unity should mention it on documents. Can someone explain to me what's the difference between editor play and build version?
     
  2. Dev_Pcpt

    Dev_Pcpt

    Joined:
    Oct 2, 2017
    Posts:
    2
    Thank you !
    Honestly, I struggled half the week because of this issue.

    How is it still undocumented ?
     
  3. PhiMue

    PhiMue

    Joined:
    Sep 21, 2013
    Posts:
    7
    Thank you, this was driving us crazy, because it worked in the editor, but not in the build!
     
  4. samCosta981

    samCosta981

    Joined:
    Mar 28, 2023
    Posts:
    1
    Thanks, bro!