<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: LoganVoisin</title>
    <description>The latest articles on DEV Community by LoganVoisin (@loganvoisin).</description>
    <link>https://dev.to/loganvoisin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F908721%2Ff282853b-01a3-4199-9e03-d63c8eefb1d4.jpeg</url>
      <title>DEV Community: LoganVoisin</title>
      <link>https://dev.to/loganvoisin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/loganvoisin"/>
    <language>en</language>
    <item>
      <title>Socket.io Basics</title>
      <dc:creator>LoganVoisin</dc:creator>
      <pubDate>Mon, 10 Oct 2022 08:20:06 +0000</pubDate>
      <link>https://dev.to/loganvoisin/socketio-basics-4ep5</link>
      <guid>https://dev.to/loganvoisin/socketio-basics-4ep5</guid>
      <description>&lt;p&gt;Socket.io is web sockets made simple. Web sockets create a path between your client and back end so they can more easily talk to each other. Socket io is primarily composed of emitters and listeners. Emitters emit a signal out to either the client or the server. However, listeners listen for a signal also from either the client or server. Here in this overview view we'll be using a tech stack that consists of Node.js, version 14, Express.js for our server, and React.js as our client.&lt;br&gt;
First up let’s look at the initial setup. We’ll want to make sure we have Node.js and Node Package Manager (npm)  installed and up to date. We can check that with the&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;js which node&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 command. If you don’t get back a file path for Node.js you need to install it. If you do get a file path and it’s not version 14.x then what you can do is&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;js npx use 14&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 that command will change over your node version to version 14.x.&lt;br&gt;
From there we can use Express.js to set up a server and React.js to make out client (see docs here &lt;a href="https://expressjs.com/en/starter/hello-world.html"&gt;https://expressjs.com/en/starter/hello-world.html&lt;/a&gt; , and &lt;a href="https://reactjs.org/docs/hello-world.html"&gt;https://reactjs.org/docs/hello-world.html&lt;/a&gt; for help). So we have our Express server set up, lets see what we need to start with Socket.io.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createServer&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Server&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;socket.io&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;httpServer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;io&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Server&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;httpServer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* options */&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;io&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;connection&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;httpServer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Okay so what’s happening here? Well, First we create our express server at the top. Then we import, “createServer '' from http and then we import server from Socket.io! That's all pretty normal so far so let’s talk about what's different. So we create an express server and call it an app, then we use that to make a new http server. Now we use that http server to make a new Socket.io server. Okay, not too bad so far… Let’s look at, “io.on(“conection)” This is a listener. It’s looking for a default event called connection. This event is emitted when a user connects to the server, then it creates a new socket for that user! The best part is Socket.io keeps track of the sockets for us.&lt;br&gt;
Let’s talk a little bit more about what a listener is. A listener listens for events, like the name suggests, and it’s identifiable with, “.on”.  The first argument is the name of the event it’s listening for and the second argument  is a callback that can have data for it’s argument. Here it's a socket which is unique for every user.&lt;br&gt;
So that's how we listen for that event but what if we want to create a custom event? Well we’ll be using React.js for our front end so I’ll give you an example of how that will look.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;io&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;socket.io-client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;socket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;io&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;isConnected&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIsConnected&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;connected&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;lastPong&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setLastPong&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

 &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;connect&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;setIsConnected&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;disconnect&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;setIsConnected&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pong&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;setLastPong&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;off&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;connect&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;off&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;disconnect&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;off&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pong&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sendPing&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;emit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ping&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Connected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;isConnected&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Last&lt;/span&gt; &lt;span class="nx"&gt;pong&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;lastPong&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;-&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;sendPing&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Send&lt;/span&gt; &lt;span class="nx"&gt;ping&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we can see some events being emitted with socket.emit. Socket.emit is how we send out an  event to the server with Socket.io!&lt;br&gt;
    These are just some of the basics of Socket.io. There is even more to learn from their documentation. Which can be found here at &lt;a href="https://socket.io"&gt;https://socket.io&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Usefull Unity Functions</title>
      <dc:creator>LoganVoisin</dc:creator>
      <pubDate>Sun, 02 Oct 2022 19:25:20 +0000</pubDate>
      <link>https://dev.to/loganvoisin/usefull-unity-functions-op5</link>
      <guid>https://dev.to/loganvoisin/usefull-unity-functions-op5</guid>
      <description>&lt;p&gt;Unity is one of many amazing ways to make games. While there is a learning curve most things can be learned rather quickly. However the scripting side of unity can be quite hard even if you know basic programming concepts.There are a lot of unity specific functions that you need to know to be able to do what you want in unity&lt;br&gt;
    The first main concept that we need to know is vector math. So &lt;code&gt;a^2 + b^2 = c^2&lt;/code&gt;, that is if we think in terms of 2D. With this we can tell unity where to move any game object as long as it’s in 2D. The function for this is &lt;code&gt;Vector2()&lt;/code&gt;, if you want to move something in 3d then you'd use &lt;code&gt;Vector3()&lt;/code&gt;. &lt;br&gt;
    Next up is &lt;code&gt;Awake()&lt;/code&gt; and &lt;code&gt;Start()&lt;/code&gt;. &lt;code&gt;Awake()&lt;/code&gt; is called before &lt;code&gt;Start()&lt;/code&gt;, and Awake will be called even if a script is disabled. So it’s best used to set up references between game objects. &lt;code&gt;Start()&lt;/code&gt; is called before the first update of the game object and only if the script is enabled.&lt;br&gt;
    Now we have FixedUpdate and Update. FixedUpdate runs at a constant time so it’s best used for game objects that have physics. Update is called as soon as it can so it's time can vary by a lot.&lt;br&gt;
    Up next we have &lt;code&gt;GetButton()&lt;/code&gt; and &lt;code&gt;GetKey()&lt;/code&gt;. &lt;code&gt;GetButton()&lt;/code&gt; is used for controller support and it’s how we detect a button press. &lt;code&gt;GetKey()&lt;/code&gt;is how we check for key presses on the keyboard. There's also &lt;code&gt;GetKeyDown()&lt;/code&gt; to see when a button was pressed down and &lt;code&gt;GetKeyUp()&lt;/code&gt; to see when it was released. We also have OnMouseDown to see when we have clicked a button on the mouse. We can also get the cursor position as well with &lt;code&gt;Input.mousePosition;&lt;/code&gt;.&lt;br&gt;
        The next helpful funtion to know is &lt;code&gt;transform.LookAt(target);&lt;/code&gt;. What this will do is point a game object's transform face another game objects. This is how we could program enemies to look at a player. We could also create a thrid person camera with this function as well. We could do that by making the camera face the player game object.&lt;br&gt;
        Then we also have two more functions that go almost hand in hand with one another, &lt;code&gt;Destroy()&lt;/code&gt; and &lt;code&gt;Instantiate()&lt;/code&gt;. &lt;code&gt;Destroy()&lt;/code&gt; removes a spesifyed game object after a certain distance it travils or after a certain amount of time. &lt;code&gt;Instantiate()&lt;/code&gt; create a new instance of a prefab game object. It also has many different options you can control, such as it's speed, rotation, position, and many other factors.&lt;br&gt;
        What if we want to just disable a component? Well then we could use &lt;code&gt;enabled&lt;/code&gt; for that. &lt;code&gt;enabled&lt;/code&gt; works like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nx"&gt;Update&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GetKeyUp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;KeyCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Space&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;myLight&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;enabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;myLight&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;what that will do is when you press space the ling will flip it's enabled status. Allowing you to turn the light off and on.&lt;br&gt;
        But, what if you wanted to enable and/or disable game objects? Well then I have the perfict function for you, &lt;code&gt;setActive()&lt;/code&gt;. Below is an example of &lt;code&gt;setActive()&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kr"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;ActiveObjects&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;MonoBehaviour&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nx"&gt;Start&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;gameObject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SetActive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;using this we can enable and/or disable game objects using scripts insted of the unity editor.&lt;br&gt;
    Those are just a few of the basic functions that are useful to know when starting unity. There are plenty of others but we don’t have enough time to get into all of them. I hope this can be a good starting point for your unity journey.&lt;/p&gt;

</description>
      <category>unity3d</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to Survive a Coding Bootcamp</title>
      <dc:creator>LoganVoisin</dc:creator>
      <pubDate>Sat, 24 Sep 2022 21:28:20 +0000</pubDate>
      <link>https://dev.to/loganvoisin/how-to-survive-a-coding-bootcamp-2a8p</link>
      <guid>https://dev.to/loganvoisin/how-to-survive-a-coding-bootcamp-2a8p</guid>
      <description>&lt;p&gt;In the world of programming a common thing here is coding bootcamps. They are programs that can take anywhere from 15-17 weeks to complete and they are usually high stress with long hours. That means losing sleep and a decline in health right? Well not exactly. It can be that way but it doesn’t have to be. I know we are given all of these different resources that we are supposed to use to help manage stress, but we never get real solutions to the way we feel. We only get wishful thinking and hopes, no results. I’m here to give real solutions to that stress. &lt;/p&gt;

&lt;p&gt;First up, sleep. It feels like we can never find a time to sleep when we have deadlines looming over us keeping us awake. We know how important sleep is but, how much should we sleep and how can we make that happen when we are programming for 12 hours a day? Well, it’s recommended that we get between 7 to 9 hours of sleep a night. But, when you have to stay up late to finish a project or squeeze in those last few lines of code it can be hard to get 5 or even 3 hours of sleep. The best fix for this I have found is naps, yes you heard me. Naps are a great way to let your mind and body rest. Since they don’t have to be long to be effective you can take a quick nap during a lunch break and get right back into programming feeling fresh.&lt;/p&gt;

&lt;p&gt;Now let's take a look at another huge thing, food. Are we eating enough? It’s really easy to skip meals when you are fixing a bug, or when you’re stuck. But, food is what fuels the brain. So we need to make sure we are eating three meals a day. How can we do this though? We barely have enough time to get work done let alone cook. Well, if you are blessed enough to have a day off during the week I suggest meal prepping. Meal prepping is a great way to make sure you have food to eat during the week! If you don’t have a day off during the week then it may be a little more difficult but I would highly recommend making time to prepare meals for the next few days.&lt;/p&gt;

&lt;p&gt;Finally we have one of the biggest things, mental health. It’s so easily forgotten when we are working. We stop looking after ourselves and then we stop taking care of our basic needs. All of this can make you feel like you are spiraling,like there's not enough time in a day. THe best way I have found to ward off these feelings and thoughts is to make sure my basic needs are met and to take short breaks throughout the day. I can not stress this enough, we can only put out our best work when we are healthy and rested. Taking breaks will help you from burning out and feeling drained.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.sleepfoundation.org/how-sleep-works/how-much-sleep-do-we-really-need#:%7E:text=National%20Sleep%20Foundation%20guidelines1,enable%20their%20growth%20and%20development"&gt;https://www.sleepfoundation.org/how-sleep-works/how-much-sleep-do-we-really-need#:~:text=National%20Sleep%20Foundation%20guidelines1,enable%20their%20growth%20and%20development&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Electron JS Windows setup</title>
      <dc:creator>LoganVoisin</dc:creator>
      <pubDate>Mon, 22 Aug 2022 13:52:15 +0000</pubDate>
      <link>https://dev.to/loganvoisin/electron-js-windows-setup-41d8</link>
      <guid>https://dev.to/loganvoisin/electron-js-windows-setup-41d8</guid>
      <description>&lt;p&gt;I’ve had this one terrible problem a long time ago where I could not for the life of me get electron js to work on windows. So, here I am to help anyone else who may be struggling like I was. I hope this can help more than the articles I read.&lt;br&gt;
    Okay first up we’ll need node.js that is a must, like in all js projects. Then what well have to do is go to the official electron site to get the download command (you can see it below)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qs6w2w9c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/phiuwpl0w0nmv27u7xs3.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qs6w2w9c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/phiuwpl0w0nmv27u7xs3.JPG" alt="Image description" width="880" height="120"&gt;&lt;/a&gt;&lt;br&gt;
    Then you’ll want to have a github account and git installed on your machine.&lt;br&gt;
    That covers the prerequisites, now to get into the meat of the topic. When using wsl and windows in combination with electron js there is one step that I missed the first time I installed electron for a project. Here was my pitfall, I missed a crucial step when I was installing electronJS. I was using wsl2! In the instructions to download electron js it specifically warns against this, so use power shell.&lt;br&gt;
    So the first steps to getting things tetup is having a directory you want lectron in, we can do this my running this little command here: mkdir my-electron-app &amp;amp;&amp;amp; cd my-electron-app&lt;br&gt;
After you run that command you can run npm init. Once that is finished run:npm install electron --save-dev &lt;br&gt;
    Then that's all to the setup.The rest of the basics you will need to actually get familiar with electron can be found in the electronjs official site. Thank you for taking the time to read this short article.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.electronjs.org/docs/latest/tutorial/tutorial-first-app"&gt;https://www.electronjs.org/docs/latest/tutorial/tutorial-first-app&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
