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

Ruby's Adventure 2D Projectile Help Wanted

Discussion in '2D' started by TheKneecapper16, Jun 24, 2019.

  1. TheKneecapper16

    TheKneecapper16

    Joined:
    Jun 24, 2019
    Posts:
    2
    As the title states I'm working on the Unity Tutorial for Ruby Adventure, and am on the Projectile Interaction and got stuck, mainly in part for being a Monday Morning (in my Time Zone anyways) and not having my brain be at 100% :D. Anyway in the second part it has you create a public variable in the Ruby Controller script and make it a Game Object. So this is where I got confused, in my defense I would have liked a picture as like a solution or something along those lines, but I mainly just want the fill in the blank answer if anyone has it that would be greatly appreciated, I got something along these lines:

    public void projectilePrefab()
    {

    }

    EDIT: Currently found the forum for Ruby's Adventure, just taking a million years to find the answer I'm looking for, so feedback is welcome nonetheless.
     
    Last edited: Jun 24, 2019
    bzjohnson likes this.
  2. Valjuin

    Valjuin

    Joined:
    May 22, 2019
    Posts:
    481
    void declares a function

    Declare public variable as follows:

    public GameObject projectilePrefab;
     
    Last edited: Jun 25, 2019
    TheKneecapper16 likes this.
  3. TheKneecapper16

    TheKneecapper16

    Joined:
    Jun 24, 2019
    Posts:
    2
    Sorry for the late response, but that makes sense and it now works, thanks a bunch! :D
     
  4. jleven22

    jleven22

    Joined:
    Mar 26, 2019
    Posts:
    421
    Also be cool with the "help wanted" posts. In this community, that means you're hiring :)
     
  5. moneil

    moneil

    Joined:
    Aug 9, 2019
    Posts:
    3
    @TheKneecapper16 Did you figure out the next part here? "Because we’ve made it public, it appears in our Editor as a slot where we can assign any GameObject. Drag and drop the projectile prefab into that slot" Where is the slot? It's not showing up for me. - EDIT SOLVED< The attached script had complier errors, so it wouldn't load and attach to the prefab in editor. Fixed script error and there is the option right at the top of the Prefab Inspector
     
    Last edited: Aug 26, 2019