Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Minor issue in 'change GameObject' scripting tutorial

Discussion in 'Community Learning & Teaching' started by Selek-of-Vulcan, Jul 9, 2022.

  1. Selek-of-Vulcan

    Selek-of-Vulcan

    Joined:
    Sep 23, 2021
    Posts:
    78
    Hi all,

    I'm pretty new here, so my apologies if I'm posting in the wrong place. I spent the day working through the Unity Essentials learning tutorials, and I've enjoyed them a lot. But I had a little trouble in "Change a GameObject with script," here: https://learn.unity.com/tutorial/ch...01f6f5ec7&projectId=5fa1dddeedbc2a0020bc3ea1#

    That tutorial calls on us to attach a script called BallTransform to a sphere primitive. Then we declare a Vector3 and use it to transform the sphere -- make it grow, say. In particular, we declare

    public Vector3 scaleChange;

    and then, in Update(), we are supposed to add this:

    transform.localScale += scaleChange;

    It's this last line that gave me a little trouble. The tutorial says if I type "transform." I should see localScale pop up as an option after I type the dot. But I didn't. When I typed transform, the IDE kept wanting to fill in BallTransform followed by irrelevant stuff. Now, I was able to complete the tutorial simply by copy-and-pasting the code, so this wasn't that big a deal. Still, I want the IDE to help me complete it myself, not to cut-and-paste other people's code.

    The tutorial does seem to be for a slightly older version of Unity, so I'm guessing that's the issue? (I'm using Unity Personal version 2021.3.5f1 and Windows 10.) If so, not a big deal, I guess, but even so, I couldn't figure out how to persuade the IDE to help me complete the code. In fact it really didn't want me to type in "transform" at all.

    Also, I want to make sure I haven't messed up how I linked Unity to VS 2019. I guess I forgot to install VS when I first downloaded Unity with Hub. So when I got to this scripting tutorial, and VS wouldn't open, I think I fixed it opening Preferences, clicking on the drop-down for external programs, browsing to (pathname/)devenv.exe in the Preferences menu, and finally selecting it as my external editor. VS opens when I double-click this script to edit it, and the IDE seems to work fine, though I do see an "install" link on the right side of the IDE inviting me to update it. (VS 2022 isn't released yet, is it?)

    Incidentally, is the Unity Essentials Pathway the best way to start? So far it seems great -- showing me everything I wanted, in more or less the order I'd like. Ultimately I plan to use Catlike Coding's tutorials to show me how to make hex grids for a simple strategy game, which is something I've struggled with in both Gamemaker and Godot.

    Many thanks in advance!
     
    Broccodie likes this.
  2. Selek-of-Vulcan

    Selek-of-Vulcan

    Joined:
    Sep 23, 2021
    Posts:
    78
    Just to answer my own question: I needed to update my Visual Studio installation to include .NET elements. Once I did that, the IDE started completing code correctly.

    Also, I've finished the Unity Essentials pathway and now am in the middle of the Junior Programming pathway. The Essentials path was a bit basic, but I still learned from it. Likewise, the programming pathway starts slow, but it's picking up speed now. I'm more interested in making turn-based strategy games than arcade games, but the tutorials are still useful for learning input, UI development, and other features common to all games.
     
    Broccodie and zielonkawybrat like this.
  3. zielonkawybrat

    zielonkawybrat

    Joined:
    Dec 6, 2022
    Posts:
    1
    Hey. The topic that You have made with Your problem was Very helpful. Even when it seems that the problem was old it can happen to anybody now or even in the future. Thanks again, for taking time to reply the answer to Your problem.
     
    Broccodie likes this.
  4. Missing-In-Action

    Missing-In-Action

    Joined:
    May 6, 2024
    Posts:
    1
    i had the same issue thanks for the help