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

A child gameobject is giving me some trouble...

Discussion in 'Getting Started' started by badSkin, Nov 26, 2018.

  1. badSkin

    badSkin

    Joined:
    Jan 10, 2018
    Posts:
    6
    Hello,

    I have a 'player' prefab that has two text objects as children.

    One of them (the 'name' object) works just fine - I can modify the transform.position etc.

    However, the second one ('points') is not responding to manipulation through script. I can't figure out why - although I'm guessing that the fact that it has a blue 'prefab' icon next to it and not a 'gameobject' icon is a clue...

    Can someone help me out? I've attached an inspector image.
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    These are UI objects. I guess that Player 0 has some component on it that automatically positions its child objects. If you look carefully at the RectTransform component of Points, I bet there's even a message there telling you that some properties are controlled by such-and-so.
     
  3. badSkin

    badSkin

    Joined:
    Jan 10, 2018
    Posts:
    6
    I don't that's the issue. I think the issue is my code is operating on a prefab and NOT an instantiated instance of it.

    If I click the NAME OBJ in the inspector, it highlights the NAME child of Player 0 object in the hierarchy... but if I click on the POINTS OBJ in the inspector it highlights the PREFAB folder and the actual prefab in that folder.
     
  4. badSkin

    badSkin

    Joined:
    Jan 10, 2018
    Posts:
    6
    Well I solved my issue. I was correct - somehow my prefab wasn't correctly made. I had to make a new one a couple times until I got it right. Not sure I fully understand it but I suppose the more I do it the more I will.
     
  5. BlankDeedxxAldenHilcrest

    BlankDeedxxAldenHilcrest

    Joined:
    Jul 10, 2018
    Posts:
    292
    I wanna make a card game, I bet it's fun.