Luke Frohling

Writer / Game Developer / Educator / Actor

Currently doing an excellent Unity tutorial (https://learn.unity.com/course/create-with-code?uv=2020.3) with an excellent tutor (He gives his name as Carl in the intro video but it isn’t mentioned anywhere else, nor is his last name).

So many interesting things to be learning:

  • The name of a script is a class, the method is a void (etc) section that does (calculates or manages) something,
  • Capitals are essential in clean coding and computer understanding, spaces are no important at all
  • If using coroutines the order of code becomes essential otherwise it’s not as stringent as I remember when I programmed in BASIC.
  • Public allows you to swap variables, functions, and methods across classes (scripts) as well as allow manual entering of data and gameObjects inside the Unity space. Private blocks it. I’ve no idea if there is any other benefit of using private over public- maybe keep Unity inspector clean and lock away variables that are only used for calculations that build to more important results? Speed benefits?
  • GameManager is an established class in Unity and storing a variable as gameManager allows you to use it. You can’t use GameManager in methods but you can use gameManager.
  • Scene sniffer → once you load up the SceneManager library (in the initial part of the class → “using UnityEngine.SceneManagement”) and then in a method to (for example) restart the game you could use the name of the scene to restart it (ie. “SceneManager.LoadScene(“SceneName”) or you can use code to sniff out the scene (ie. “SceneManager.LoadScene(SceneManager.GetActiveScene().name);”. Nice!
  • Interesting – playing a scene from Unity makes the screen do whatever you’ve set the screen to do (in mu case make it entirely blue) but hitting restart inside the game makes the game window NOT show that blueish hue and instead go to normal (you-can-edit normal) colours instead of staying in the “play state colours”.
  • Interestingly (not mentioned in the tutorial) the scene got darker when transitioning (not the blue as I thought) as it was mentioned in the discussions. Two of the people gave me an answer- one said Window/Rendering/Lighting and tick auto-generate but another went on and said I had to create a new lighting setting which allowed me to tick that button 🙂
  • “AddListener” is a strange in script thing required to follow an onClick… seems weird to need it but it does have the method it runs in brackets (when mouse is clicked).

Facebook
Twitter
LinkedIn

Featured Post

Outside

During the week I’m consumed at work –…

Manager

I’ve been a manager for Ready Team One…

Hand Tracking

Continuing from last post and I took the…

Hand Tracking

Tales from the battlefield continued. I’ll try this…

Forward

Frustrating. I’ve spent days trying to get Link…

Fixed The…

This took weeks. First problem was the cable…

Give Me…

Trying a new tutorial as the other ones…

VR (and…

VR / AR Direct: https://www.roadtovr.com/ – Computer news…

Geoff’s Way…

You may need to check previous posts to…

Scroll to Top