[Odin Validator] - SceneObjectsOnly attribute misinformation

Issue #877 open
hugh created an issue

public class TestMono : MonoBehaviour
{
    [SceneObjectsOnly]
    public RectTransform rectTransform;
}

OdinValidator scan prefab will report error “RectTransform from Canvas cannot be an asset.”

Canvas should be recognized as “SceneObjects” because the prefab will instance in scene at last.

Comments (5)

  1. Bjarke Elias
    • changed status to open

    Hmm, could you clarify a bit? Because in this case the reference you provided is not a scene object reference, so what the error is telling you is correct. (You’re in a prefab stage, modifying the prefab) What you’re after is disallowing cross prefab references perhaps?

  2. hugh reporter

    The point I am trying to tell is the object picker allow me to select rect transform in prefab (even the RectTransform field has “SceneObjectsOnly” attribute), so reference to something inside prefab itself should not be an error.

  3. Bjarke Elias

    Oooh I see. I also missed the fact that the Validator is showing an error and the inspector is not, sorry about that. The SceneObjectsOnly attribute is not working correctly! We’ll get on it.

  4. Log in to comment