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.

Question Area of an instantiated child prefab

Discussion in 'Visual Scripting' started by gavinprior, Mar 20, 2023.

  1. gavinprior

    gavinprior

    Joined:
    Jul 27, 2020
    Posts:
    28
    Hi all.
    Ok. Here's my scenario:. I have a prefab (with child objects) that I instantiate into the scene which works fine. Let's call that Farm.
    I have another prefab object(let's say a chicken) that I then want to add to the Farm but - I only want to add the chicken in a particular area in the farm. Let's call that (child object/ layer) the Field.
    Sooo. How do I find the Field layer on the instantiated Farm prefab?

    I can get the Farm object name directly after I've instantiated it, but can't figure out the rest(!) Mostly due to time constraints, so thought I'd ask the collective.

    Thanks for your thoughts and hope it makes sense!

    Gavin
     
  2. gavinprior

    gavinprior

    Joined:
    Jul 27, 2020
    Posts:
    28
    Couldn't figure it out so I simplified it. Rather than going around in circles I just drop items randomly between -4 and 4 on the x axis. Works but doesn't allow for non conforming shapes. Meh.