Search Unity

ISSUE: Unity Manual Script Examples Incomplete

Discussion in 'Scripting' started by Mystic_Warrior, Jul 26, 2017.

  1. Mystic_Warrior

    Mystic_Warrior

    Joined:
    Jul 12, 2017
    Posts:
    2
    OK... I am new to Unity but with over 30 years of of Programming Experience I can usually figure out most Programming Languages so understanding C# is not difficult.

    That said, understanding Unity Software is like landing on Mars with only basic "map" which only one big "X" for your "goal" and some general instructions of "read the manual".

    I am a "learn by doing" type of Programmer, in that I start with a basic "Hello World" type of Program and move on from there, exploring new Commands, Functions, Program Abilities, etc.

    While "Tutorials" are nice, for me sometimes they are too basic, and often don't answer other related questions that might arise.

    So... here I am... asking some "noob questions" in hopes someone can pull an answer from the murky fog of Basic Unity Software Knowledge and help myself and perhaps others whom feel the same way.

    SO LETS TACKLE A BASIC QUESTION - "How To Display Position of 0, 0, 0 (x, y, z)?"

    1. I found this Script Example: here
    2. It uses the Print Function which is described here
    This is where the Title of this Thread becomes apparent - that is - there is no complete working example in the Manual with instructions on how to properly use. Do I assign the example script to an Object, or Child-Object and if so where is a "Working Example" showing a complete C# Script and step by step instructions.

    Simply using the Camera, then Adding a Script Component called "
    ExampleClass", then Copy-Paste the Script Example in MonoDevelop and then clicking on Play [►] does not do anything. (Ok I will admit that I am most likely not using that C# coding correctly but that is my point).

    All I see in the Manual mostly are general information about a particular Command, Function or Method, along with some Example "Program Fragment" and no other information on how or where the examples are to be used to include step by step instructions for at least one example.

    HERE IS A HARDER QUESTION - "How To Display a AssetBundle Object Loaded From Disk?"

    Before anyone asks, I have already read the Manual for AssetBundle.LoadFromFile found here along with the related Manual instructions found here.

    Put simply - given you have a file called - let's say for example "Test.assetbundle" - that containing 1 complete Object loaded from somewhere on your Computer how would you get that "Test.assetbundle" to display in the center of your scene during Runtime?

    Just that... no more... as you can then later manipulate the loaded "Object" with appropriate C# Coding.

    BOTTOM LINE: If the Unity Manual had individual working examples that I (and others) could test / learn each new command on my (their) own it would be great.

    I prefer to work mostly outside of individual "Tutorials" which may or may not cover or mention a particular Function or Method since it is assumed the reader has some knowledge already, which in my case re: Unity Software, I do not have a lot of - but I am learning...

    Any help or comments are welcome.
     
  2. GameDevJon

    GameDevJon

    Joined:
    Jul 21, 2017
    Posts:
    25
    I came from working with 100's of java files and a compiler, and when I got to Unity, I too hit that struggle. It became what the hell is this? And how do I make these work.

    The answer is, it takes time. The scripting reference is a "reference" for information about the UnityAPI. The examples they provide can't possibly tailor to everyone's needs. It's important to read the descriptions and understand their use case.

    Check out this series: https://www.youtube.com/playlist?list=PLadYLGMfR6Lphpq1PZFo25_acWAEuoLh_

    That's the Fundamentals series. On that channel, you'll find Intemediate and Advanced programming in c# with Unity. This may help you get more familiar with things. Also watch the "Practical" exercises at the end of each one.
     
  3. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    When you say "It does not do anything", are you looking in the Console output? It will likely just show "0" per the script that you posted.
     
  4. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
  5. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    It's challenging, for sure.

    You can find tutorials and free coding examples on the web and in Unity's own Learn section. You can also find free script samples in the asset store. (There's a ton of free stuff in the store these days ... it's much better than it used to be.)

    Sometimes you can find answers to gnarly coding questions in forum threads and in the "answers" area.
     
  6. Mystic_Warrior

    Mystic_Warrior

    Joined:
    Jul 12, 2017
    Posts:
    2
    Thanks everyone for your suggestions and advice.

    While no one answered the Basic Question or Harder Question, I was curious to see if anyone would. I will look through the online Tutorials and other "Starter Information" and continue my self-help.

    STILL... For those whom control the "content" of the online Unity Manual, the inclusion of step by step instructions for one example use of each Command / Function / Method that can be used by any Unity User would be helpful as a reminder / refresher and also aid those new to Unity.

    While example Scripts are nice they are worthless if you can't see them in "context" in a full working example along with step-by-step instruction that someone can use by starting a new project and simply add the example coding and following some instructions just to see what happens.

    As already stated, the Unity User needs to be a experienced / advanced programmer to effectively use any of the information found in the current Manual and those new to Unity and/or C# should look elsewhere for information.
     
    Last edited: Jul 27, 2017
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Mystic_Warrior My previous post mentioned that it might already be working for you! Did you look at the console output? I assumed you attached it to (any) object. Or is that where you are having difficulty?
     
  8. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    Not really. The manual explains how the Editor and Engine work - only a portion of which involves actual programming. If you want documentation on the API and some code snippets then there's the Scripting Reference.

    I mean really - it's not clear what you want. You say
    which sounds an awful lot like what a tutorial would cover....but then
    To answer your hard question - once you load the AssetBundle (via the method you linked) you can load the specific asset using this: https://docs.unity3d.com/2017.1/Documentation/ScriptReference/AssetBundle.LoadAsset.html and then Instantiate a copy into the scene: https://docs.unity3d.com/2017.1/Documentation/ScriptReference/Object.Instantiate.html

    All of which you can find more info on in the Learn section: https://unity3d.com/learn/tutorials...undles-and-assetbundle-manager?playlist=17117
     
  9. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    Crib sheet for thinking about Unity3D:

    The scene is the basic "document" in Unity3D. You open scenes kinda like Word Documents, change them, save them to disk, or often discard the changes, etc. A common workflow is to open a blank scene, do some things, then discard the whole thing.

    Windows: (recommend 2x3 layout, but any is fine)

    GAME is what you will see when playing
    SCENE is the view into your "document," where you edit positions and rotations of things
    PROJECT is a view into your /Assets folder, where every file you make or import goes
    HIERARCHY is the "tree/list view" of the pieces of your scene, aka your "document"
    INSPECTOR is the detail view of whatever is selected, either in-scene or in-project

    The editor can either be STOPPED, PLAYING, or PAUSED. See buttons at top center.

    All changes made to the scene while PLAYING are lost when you STOP. Be careful to only make changes to the scene while STOPPED.

    Other terms:

    Everything in your scene is a GameObject. Each GameObject has a name. Names can be the same or different.

    GameObjects contain Components. Every GameObject has a Transform component. It often has many more components, such as Camera, Light, or anything else that you create.

    Every script you make is a Monobehavior, which is a type of Component that goes on GameObjects.

    Every Monobehavior is inspected for functions. The Awake() and Start() functions are called once, and then Update() is called every frame.

    GameObjects may be "parented" to each other in a hierarchy fashion.

    Collections of GameObjects in the scene can be dragged to the Project/Assets area, and this creates a new asset that contains a snapshot of those GameObjects and all of their components. This is called a Prefab.

    That's it. The rest is just the usual fiddly busy work of making a game. :)
     
  10. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    Honestly, when I picked up Unity, I already knew c# but knew almost nothing of Unity and components and assetbundles. I just started watching tutorials and getting a grasp of how things work. Over the years as I found stuff I wasn't sure of, I looked it up.

    I still encounter stuff every now and then, but for the most part just getting an understanding of how Unity works allows me to understand what to do. I'm assuming the same will hold true for you since you have a programming background.

    The scripting reference that @KelsoMRK mentioned does contain some code snippets and Unity has a great learn section as well, but it has been my experience that the tutorials found on youtube by other developers tend to be a great source as well.