Graphic Design
نوێترین بابەتەکان
بەم زووانە...
Showing posts with label unity 3d. Show all posts
Showing posts with label unity 3d. Show all posts
Scripting
Learn about programming from scratch, then progress to create detailed code for your projects.


Beginner Gameplay Scripting

 
Scripts as Behaviour Components
 What are Scripts in Unity? Learn about the behaviour component that is a Unity script, and how to Create and Attach them to objects



C#:

using UnityEngine;
using System.Collections;

public class ExampleBehaviourScript : MonoBehaviour
{
    void Update ()
    {
        if(Input.GetKeyDown(KeyCode.R))
        {
            gameObject.renderer.material.color = Color.red;
        }
        if(Input.GetKeyDown(KeyCode.G))
        {
            gameObject.renderer.material.color = Color.green;
        }
        if(Input.GetKeyDown(KeyCode.B))
        {
            gameObject.renderer.material.color = Color.blue;
        }
    }
}

 
 
JS:
 
#pragma strict

function Update ()
{
    if(Input.GetKeyDown(KeyCode.R))
    {
        gameObject.renderer.material.color = Color.red;
    }
    if(Input.GetKeyDown(KeyCode.G))
    {
        gameObject.renderer.material.color = Color.green;
    }
    if(Input.GetKeyDown(KeyCode.B))
    {
        gameObject.renderer.material.color = Color.blue;
    }
}


BOO:

import UnityEngine
import System.Collections


public class ExampleBehaviourScript(MonoBehaviour):

    private def Update():
        if Input.GetKeyDown(KeyCode.R):
            gameObject.renderer.material.color = Color.red
        if Input.GetKeyDown(KeyCode.G):
            gameObject.renderer.material.color = Color.green
        if Input.GetKeyDown(KeyCode.B):
            gameObject.renderer.material.color = Color.blue

 

Unity 3D Tutorial For Beginners - How To Make A Game - Part 002

In this episode, we continue building our world with a new building. We fine-tune our objects, and set some textures. We also play our world for the first time.



Previous Lesson
Unity 3D Tutorial For Beginners - How To Make A Game - Part 001