Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Error Building Player, No RectTransform

Discussion in 'Editor & General Support' started by emergki, Feb 14, 2018.

  1. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    421
    Hi, I'm having the issue below when I try to build my game to Android, I'm using Unity 2017.3 (and, this project was building normally in Unity 5.6.0).

    How can I fix it?

    Error building Player: MissingComponentException: There is no 'RectTransform' attached to the "Missing Prefab (Dummy)" game object, but a script is trying to access it.
    You probably need to add a RectTransform to the game object "Missing Prefab (Dummy)". Or your script needs to check if the component is attached before using it.
     
  2. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    It seems like there's a script on a Dummy gameobject that uses GetComponent<RectTransform>() but there isn't one attached.
     
  3. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    421
    Yes, but, I already check all the objects of the scene, and looks like everything is fine :(
     
  4. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Is there a script on the Dummy object using GetComponent<RectTransform>()? If so, use
    Code (CSharp):
    1. if(GetComponent<RectTransform>()!=null)
    That way the code won't run if there isn't a RectTransform component.
     
  5. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    421
    I have no gameobject called "Dummy" on the project. :(
     
  6. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    421
    This only happens when trying to build! Never happens in play mode
     
  7. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Strangest thing ever. Are you sure you have no Dummy GameObjects, and no Dummy prefabs? Does double-clicking on the error do anything?
     
  8. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    421
    I don't have any dummy gameobjects or prefabs...

    But, Exactly now, I have just put some "if" where I use the rect transforms and now it builds normally...

    The strange thing is, in all places I have the RectTransform, I was putting the RectTransform directly on the inspector (not by script), so, there is no way to "don't" found the RectTransform.

    Thank you!
     
  9. Realform

    Realform

    Joined:
    Mar 20, 2015
    Posts:
    9
    If you have multiple scenes with UI there should be one that got broken because maybe you delete a prefab of that UI, that thing happened to me right now :S
     
  10. domdev

    domdev

    Joined:
    Feb 2, 2015
    Posts:
    375
    do you have any solution for this?