26 de mar. de 2023

VR Minigame about Mathematical fractions

 This game was made for a Positivo's event in Curitiba. 

It is focused on the 5th grade and is intended to practice fractions.

You must solve an enigma from Dr. Ignorancius. You have to put the correct disc inside the altar. There is a vase with a fraction below it, and you have to get the correct disc that has the fraction drawn and insert it into the altar.

24 de mar. de 2023

Kiduca VR - demo

 A VR demo developed in Unity using assets from our platform 3D.

It was shown/experienced in a big educational event called Bett Brasil in 2022, and was a success!

(2014) SweepKik - multiplayer game with a different approach

I found this video recently. 

I made a multiplayer game for my undergraduate thesis in 2014 for Game Production with Unity.

It was a server (PC) that we could connect by cell phone and play Quizes in two environments (basket and archery).

The interesting was the ability to integrate the mobile with the PC: we threw the ball and the arrow in the mobile and they appeared on the PC. You could change the directions, force, and angle you throw them in the first version.

7 de mar. de 2023

Design Patterns, Clean Code and SOLID for Games

 Are you looking for content about Design Patterns, Clean Code, and SOLID for Games?

Bellow, I show some books, links, and videos that I found during my research about the subject.

I hope you like it.


  1. Level Up Your Code with Game Programming Patterns by Unity
  2. Game Programming Patterns by Robert Nystron
  3. Game Development Patterns with Unity 2021 by David Baron
  4. Design Patterns: Elements of Reusable Object-Oriented Software by Group of four 
    1. Not about games, but a "Must read it"

29 de set. de 2021

Using Ripped Spritesheets for Tests and Demos in Unity

At https://www.spriters-resource.com you can find several Spritesheets, but... you have to spend some sweat on it to get it useful for Unity.

  1. Download and install a Photoshop Script called "SpriteSheet Generator" here

  2. Take off the Background from the original Spritesheet with Photoshop - Select - Color range...

  3. Select and copy the first frame of the animation that you want to use, for example, Idle.

  4. Create a new File in Photoshop using the copied frame in memory.

  5. Copy one by one the frames from the original Spritesheet  (Idle animation) and paste it in the new File creating a new Layer.

  6. Change the Canvas size of the new file to fit the other frames (if needed)

  7. Make any needed adjustments in positions.

  8. Open the "Timeline" Window and Click on "Create Frame Animation" in the Timeline Window

  9. Choose "Make Frames From Layer" in Timeline Window

  10. Follow the "Usage" section in the link above to create the Spritesheet

  11. Crop the file in a way that the Unity will Slice it easily.

  12. Export as PNG

14 de set. de 2021

Getting screen size in World Coordinates

obj1.transform.position = Camera.main.ViewportToWorldPoint(new Vector2(1, 1)) + new Vector3(0, 0, 10);
obj2.transform.position = Camera.main.ViewportToWorldPoint(new Vector2(0, 0)) + new Vector3(0, 0, 10);

(1,1) is the top right corner of the screen in Viewport coordinates.
(0,0) is the bottom left corner of the screen in Viewport coordinates.

I add a Vector3 to adjust the Z position.

Camera.main.ViewportToWorldPoint() converts a viewport position into World postion.

If you move the Cam, the position of the corners (pink dots) follows the Cam, if inside Update().

8 de set. de 2021

(Kiduca) - Checkpoint (animation, SoundFX, FX, Code)


It opens when the player gets close and it becomes the actual "Checkpoint".

2 de set. de 2021

Teaching Unreal - Materials and Lights

  •  Base and Instance Materials
  • Color Material
    • Metallic
    • Roughness
    • Specular
  • Texture material with Normal (+ intensity)
  • Emissive materials  (+ intensity)
  • Directional Light
  • Point Light
  • Spot Light
  • Sky Light
  • Rect Light

19 de ago. de 2021

(Kiduca) Dr. Ignorancius new device: BigHammer

 In the Lab of Dr. Ignorancius, he experiments his new devices...

23 de mar. de 2021

Speed up Unity entering in play mode


How to get more free space in your C:\?

 I have an SSD as my System drive and it always gets full even with all my Softwares and Data been saved in another HD.

Searching on the web, I found this article that really helped me.

The Complete Guide to Creating Symbolic Links (aka Symlinks) on Windows

Basically, you must:

  • Copy the content of folder C:\Tmp into another partition, ex: D:\Tmp
  • Right-click D:\Tmp and select "Pick Link Source"
  • Go back to C:\, right-click and select Drop as "Junction"
C:\Tmp will be a "shortcut" to D:\Tmp.
The content will be at D:\Tmp, but if you write in the Console window C:\Tmp, you will see all the files.

3 de out. de 2020

Moving like "Castle Crashers"

 A simple example of moving your character like the game Castle Crashers.

  • Up and down limits
  • Move Up and Down inside a Y range
  • Move Right and Left
  • Jumping
    • Go up while jumping
    • Go down while jumping

Download Code Example

29 de jun. de 2020

Pink materials when testing Addressables in Editor

If your project is set for Android and you set the addressable for "Use existing builds" (will load remotely the bundles) some materials will turn pink when you run in editor mode because the editor uses Direct3D11 as API.
You must change the settings to use OpenGLS3 in the editor to correct this.

30 de abr. de 2020

ITweenFRC - Easy UI animation

I´ve created a Class that works with iTween and turns it easier to Move and Scale UI Elements.

  1. Download the iTween package at Asset Store.
  2. Drop the iTweenFRC Class into a GameObject and set its parameters:

  • Target -position or scale to reach
  • Delay - time to wait to start the tween
  • Time - time that will last the tween
  • Mode - Move or Scale
  • Ease Type - A list of Easetype.(Ex: linear, spring, etc..)

Download Here: ITweenFRC

27 de fev. de 2020

OBS -Black Screen recording

When I try to record from my Notebook, the screen is always black, no matter what I configure de app.
I found the solution in this Page.
Basically,I opened the Windows Settings - Graphic setting and set "Power Saving" for the OBS executable.

14 de jan. de 2020

Jumping like Mario

We can control:
  • The Highest Jump Height (JumpVelocity and Gravity)
  • The velocity he goes Up (JumpVelocity and Gravity)
  • The velocity he goes Down (Fall Multiplier)
  • The Lowest Jump Height (Low Jump Multiplier)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Jump : MonoBehaviour
    Rigidbody2D rb;

    public float speed = 5;                 // Horizontal speed to move

    public float gravity = -5;              // force that influences when jumping (going up with button, going up without button, falling)
                                            // this force stops the jump for going up.
    public float jumpVelocity;              // velocity set for the jump
    public float fallMultiplier = 2.5f;     // force that inflences when the player is falling
    public float lowJumpMultiplier = 2f;    // force that influences when the player is going up withot pressing the button

    float hor;

    public LayerMask whatIsGround;          // what is floor?
    public Transform feetPos;               // where the isGrouded OverlapCircle is positioned
    public float checkRadius;               // the radious of OverlapCircle
    bool isGrounded;                        // if its grounded or not

    private void Start()
        rb = GetComponent<Rigidbody2D>();

    private void Update()
        hor = Input.GetAxis("Horizontal");

        isGrounded = Physics2D.OverlapCircle(feetPos.position, checkRadius, whatIsGround);

        if (Input.GetButtonDown("Jump") && isGrounded)
            GetComponent<Rigidbody2D>().velocity = Vector2.up * jumpVelocity;

    private void FixedUpdate()
        rb.velocity = new Vector2(hor * speed, rb.velocity.y);

        if (rb.velocity.y < 0) // if is falling, accelerate
            rb.velocity += Vector2.up * (-fallMultiplier);
        else if (rb.velocity.y > 0 && !Input.GetButton("Jump")) // if is going up and not pressing button, force down
            rb.velocity += Vector2.up * (-lowJumpMultiplier);

        // always applied if not grounded
        if (!isGrounded)
            rb.velocity += Vector2.up * (gravity);

    private void OnDrawGizmos()
        bool isGrounded = Physics2D.OverlapCircle(feetPos.position, checkRadius, whatIsGround);

        if (isGrounded)
            Gizmos.color = Color.red;
            Gizmos.DrawWireSphere(feetPos.position, checkRadius);
            Gizmos.color = Color.green;
            Gizmos.DrawWireSphere(feetPos.position, checkRadius);

13 de jan. de 2020

Yes! I bought one Atari 2600 "Darth Vader"

This vacation I finally bought the first video game that my father gave me when I was 8 years old: Atari 2600 "Darth Vader"!
It was broke, but I found a guy that helped me fix it.

In the same weekend, I bought some cartridges at the fleamarket
  • Space Invaders
  • Pitfall
  • Frogger
  • Nexar
  • Fantastic Voyager
  • Damas
The Frogger cartridge broke the day after I had bought it, then I have to fix it. But now, everything is working just perfect! :)

3 de jan. de 2020


I was looking for an easy way to move GameObjects around, and I found the iTween Asset.
  1. Import the Asset
  2. Insert the code in Class from the GameObject that you want to move.

Hashtable ht = new Hashtable();
ht.Add("x", transform.position.x);
ht.Add("y", transform.position.y + 1f);
ht.Add("time", 2);
ht.Add("oncomplete", "AnimationEnd");
ht.Add("oncompleteparams", sender);
ht.Add("easetype", iTween.EaseType.linear);
ht.Add("scale", new Vector3(1, 1, 1));
iTween.ScaleTo(panel, ht);
iTween.MoveTo(gameObject, ht); 


One problem happened using iTween inside a GameObject that animate another GameObject. The "oncomplete" was never called. I found the solution in this Post.

29 de dez. de 2019

Change Animator Controller Asset in Runtime

I needed to change the Animator controller in runtime and one solution was to load de Animator Asset from Resources folder.

  • Put the Assets in Resources folder
  • Load de asset using:

animator.runtimeAnimatorController = Resources.RuntimeAnimatorController("AssetControllerName");

3 de dez. de 2019

Visual Studio 2019 Community without intellisense for Unity

Edit > Preferences > External Tools > External Script Editor

Find your VS 2019, normally it´s installed in 

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe

27 de jun. de 2019

Another way to create Fade by Code

This must be inside a Coroutine method that returns a IEnumerator.
TransitionTime is the time that you want it takes to perform the Fade.

20 de jun. de 2019

Dropbox - aproveitar pasta já existente

Cheguei um dia e meu Drobox estava padindo para se logar. Fiz o login e percebi que ele estava atualizando TODO o conteúdo novamete na pasta padrão. Eu uso o conteúdo do Dropbox em um HD externo.

  1. Desvinculei a minha conta do dropbox no computador.
    botão direitono icone - configurações - preferências
    Conta - desvincular este dropbox...
  2. Fiz login novamente
  3. Opção de escolher pasta destino

16 de jun. de 2019

How to create a documentation of your Project

  1. Install Doxygen 
  2. Open the DoxygenWizard
  3. Step 1: find the folder where the Doxygen was installed.
  4. Step 2: fill the basic information:
    Project name
    Source code directory (folder where you can find your scripts)
    Destination directory (where the doc will be saved)
  5. Click next until the RUN tab.
  6. "Run doxygen"
Is that simple! Now you just need to click on "Show HTML output"

How to create a C# Snippet in Visual Studio Community

  1. Create a new XML File
  2. Copy de template bellow.
  3. Change de Title, Author, Descsription, Shortcut and mainly the CDATA content.
  4. Save as FileName.snippet
  5. Open
    Tool - Snippet Manager and import the XML file into CSharp "My Code Snippets"
  6. Done

Now, you just need to write the Shortcut and press TAB.

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
            <Code Language="">

17 de fev. de 2019

ShaderGraph - Vertex displacement Shader

Testing Vertex displacement Shader using ShaderGraph.
A sphere modifying its vertices.

Download Shader

1 de ago. de 2018

ShaderGraph - Refraction

In LW Render Pipeline you have a property called "Opaque Texture". If you check it, you can use a Texture 2D Node with the reference named "_CameraOpaqueTexture" to access the camera content and than you can do whatever you want with it :)

24 de jun. de 2018

Android - Debug your game (Unity)

There is no way, you´ll need to debug your game/app directly in your Android device.
So, for that, you need to:

  1. Set up Unity to Build in Developer mode
    1. File - Build Settings - Development Build
      1. Run Device - choose the device that is connected via USB, my example Lenovo A7010
      2. Script Debugging
    2. Build and Run
    3. Console - Choose "Android Player (XXXX)"
  2. Wait until your game starts into your device
  3. Set up Visual Studio 2017
    1. Debug - Attach Unity Debugger
      1. Your devices must be showed in the list, choose it.
  4. Now,  you just need to put breakpoints to stop the game and debug what you want.
Problem: The build freezes at the last part of the process: copying apk package when using "Build and Run". The solution is:
  • Changed the USB port (front to back por of the PC)
  • or Delete the app in the cellphone
I used "c:\adb>adb install -r Minigames.apk" to try to send the apk by command line, but it was not going.

21 de jun. de 2018

Looping a range of number using mod "%"

If you want to loop through a range of number and starts from the beginning again, you can use Mod "%".

destPoint = 0;
destPoint = (destPoint + 1) % patrolTargets.Length;

if patrolTargets.Length = 5, for example, destPoint will be 0, 1, 2, 3, 4 and 0 again, if the expression is inside a loop statement.

20 de jun. de 2018

Limit Max Width of a Layout Component in Unity

Problem: Expand the size of a button according to its text, but with a limit in the width.

After a while searching for something to solve my problem, I found this link that helped me.

2 de jun. de 2018

Parabole movement

How to make a GameObject jump as a Parabole.

public float height;
    public float duration;

    void Update () {
        if (Input.GetKeyDown(KeyCode.Space))
            StartCoroutine(Jump(height, duration));

    IEnumerator Jump(float height, float duration)
        float lastY = transform.position.y;
        Vector3 startPos = transform.position;
        Vector3 endPos = transform.position;
        float time = 0f;

        while(time <= 1)
            time += Time.deltaTime / duration;
            float yOffset = height * (time - (time * time));
            transform.position = Vector3.Lerp(startPos, endPos, time) + yOffset * Vector3.up;

            yield return null;

        transform.position = new Vector3(transform.position.x, lastY, transform.position.z);

1 de jun. de 2018

Unity: resize a Button with its content (text)

If you want that your Canvas Button to resize according to its content.
A good way to solve this problem.

How to Git with Unity

I found this interesting article on How to Git with Unity.


22 de mai. de 2018

Serialize and Deserialize Json and Json Array in Unity

If you need a more complex serialization, the native JsonUtility will not help you.

In this post you can find the solution for the problem.

20 de mai. de 2018

Create a Normal Map in 3DS max

  1. Create a Plane Standart Primitive: plane1
  2. Select the plane1 and Unwrap it

  3. Duplicate the Plane and make some modifications: plane2

  4. Put plane1 in the same position of plane2

  5. With plane1 selected,open Rendering->Render to Texture
    1. click on Pick to select the Plane that we will create the normal: plane2
    2. clck on Options

    3. In Options window, choose in Orientation Green: Up (to use in Unity)
    4. Click on Setup

    5. In Setup window, in Render tab, check Enable Global Supersampler

    6. Close setup window, Projection Options
    7. Back to Render to Texture window, choose Use Existing Channel
    8. Add texture element NormalsMap
    9. Choose "Bump" in Target Map Slot
    10. Choose the map resolution (1024x1024)

    11. plane1 now has an Projection Modifier

    12. Selecting Projection Modifier, we can see the Cage section, click in Reset and increase the Amount until the "cage" is surrounding the modification of plane2

    13. Render To Texture: click in Render

12 de abr. de 2018

Unity Animator states not showing which is playing at runtime.

If your Animator window is not showing a little progress bar when you hit play, try to select the GameObjet that has the animator controller that references to this Animator asset.

25 de mar. de 2018

PHP - enable cross-origin resource sharing

If you don't have access to configure Apache, you can still send the header from a PHP script. It's a case of adding the following to your PHP scripts:
Note: as with all uses of the PHP header function, this must be before any output has been sent from the server.
Site: https://enable-cors.org/server_php.html

20 de mar. de 2018

3D max - How to remove Peel seams (blue seams)?

In the Unwrap UVW panel > Click Edit Seams to turn on Edit mode > Alt+Left Click the seam you want to remove.

23 de fev. de 2018

How to delete the Unity´s GI cache?

"The GI cache is used by the Global Illumination (GI) system to store intermediate files when precomputing real-time GI, and when baking Static Lightmaps, Light Probes and Reflection Probes. The cache is shared between all Unity projects on the computer, so projects with the same content and same version of the lighting system (Enlighten) can share the files and speed up subsequent builds."

Find the settings for the GI cache in Edit > Preferences > GI Cache on Windows, or Unity > Preferences > GI Cache on macOS.

source: https://docs.unity3d.com/Manual/GICache.html

Where does Unity keep the dowloaded Packages from Asset Store?

You can find the downloaded Packages from Assets Store in the folder:

C:\Users\YOURU_SER\AppData\Roaming\Unity\Asset Store-5.x

13 de jan. de 2018

Unity - Problem building for Android

When I was trying to build for Android, Unity started to show me an error message:

"Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details."

I found this post that solved the problem.

8 de jan. de 2018

Controle PS4 no PC via Bluetooth

Achei este artigo do Tecmundo.
Fiz os passos "Dualshock com cabo" e depois "Dualshok 4 com Bluetooth".

Rodando perfeito!

  • Ligue o Bluetuth no Note/PC
  • Abra o Painel de Controle
  • Pressione PS + Share no Controle do PS4
  • Clique em avançar

21 de dez. de 2017

Vector3.SmoothDamp - smooth transaction between 2 vectors

Vector3 velocity;
public float time = .5f;

transform.position = Vector3.SmoothDamp(transform.position, newPosition, ref velocity, time);

Using Bounds Class to get center of many objects

We can use the Bounds Class to get the center of many objects in the scene.

 private Vector3 GetCenter()
  if (targets.Count == 1)
   return targets[0].position;

  Bounds bound = new Bounds(transform.position, Vector3.zero);
  foreach (Transform target in targets)

  return bound.center;

13 de dez. de 2017

Texture Tools for Adobe Photoshop - NVidia Plugin

Plug in for Photoshop to create Normal Map from an image. See thisTutorial

11 de out. de 2017

C# - instantiating a Class from String

How can we instantiate a class from a String?

string state = "BeginState";

Type type = Type.GetType("Assets.States." + state); object instance = Activator.CreateInstance(type, new object[] { stateManager }); stateManager.SwitchState((IStateBase)instance);

5 de out. de 2017

Working with Relative Paths in 3ds Max

3D Max Menu - Manage - Asset Tracking
Select All files
Right Click - Make Path Relative to Project folder


Customize - preferences - Files - Conver Local file paths to Relative

7 de jul. de 2017

Testing your game with "Unity Remote"

To test the games that we are developing into a real cell phone, Unity provides us with the app "Unity Remote".
But it is not so easy as plug the cell in the computer and press Play in Unity Editor.

I had some troubles connecting my Lenovo Vibe K6 - Android 6.0.

After I unlocked the "Developer option" in my cell phone:
  • Settings 
  • About device 
  • Click many times over "Build Number"
The "adb devices" prompt command was not showing my Lenovo :(, so, it was not being detected as a device to be used by another application, even if in the Explore it was been shown.

Inside "Settings - Developer", I had to setup the configuration´s USB protocol to "PTP (Picture Transfer Protocol)"

Then when I run adb, it shows me my device and Unity started to play the game direct in Unity Remote.

If adb is showing the device, you just need to run the "Unity Remote" in your cell phone (download in Google play/Apple Store) and run your game in Unity. It will automatically run the game on your device.

It´s MUCH better than transfer the .apk file every time that you need to test a new functionality.

Problem using ASUS Zenfone with Unity 2019.1

  1. Android - enabled Developer Options
  2. Developer Options
    1. Keep Awake
    2. USB debug
    3. Select USB Options
      1. Load this device

  1. Unity
  2. Project Settings - Unity Remote - Device - Any Android Device
  3. Build Settings - Run Device -
  4. **Preferences - External Tools
    1. Uncheck Andoird SDK Tools Installed with Unity
    2. Fill the path with the SDK path:
It does not matter the order that I open Unity, connect android or open Unity Remote

6 de jul. de 2017

Background Paralax - model 1

There are some ways to make the Background run as if the camera was moving.

In this example, we move the Gameobject with the SpriteRender with a child with another Gameobject with the same image (duplicate de Gameobject) in the scene and when it reachs the startPosition + hisSize, it comes back to the startPosition.

using UnityEngine;

public class Paralax : MonoBehaviour {

    public float scrollSpeed;
    public float tileSizeZ = 0;     // if changed in edit time, it uses this value for the size of the SPriteRenderer
                                    // Used in images that are shorter than the screen width

    private SpriteRenderer sprite;  // the SpriteRender of the GameObject
    private Vector3 startPosition;  // Start position of the GameObject

    void Start () {
        sprite = GetComponent<SpriteRenderer>();
        startPosition = transform.position;

        if (tileSizeZ == 0)
            tileSizeZ = sprite.bounds.size.x;

    void Update () {
        /* Repeat works like:
         if Time.time * scrollSpeed < tileSizeZ, newPosition = Time.time * scrollSpeed
         else, newPosition = (Time.time * scrollSpeed) - (loopIndex * tileSizeZ) */
        float newPosition = Mathf.Repeat(Time.time * scrollSpeed, tileSizeZ);
        transform.position = startPosition + Vector3.left * newPosition;

2 de jul. de 2017

Following Mouse in 3D

A simple example of an object following the mouse in 3D environment.

using UnityEngine;

public class FollowMouse : MonoBehaviour

    public float force;

    Rigidbody ballRigid;
    Ray ray;

    void Start()
        ballRigid = transform.GetComponent<Rigidbody>();

    private void Update()
        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        Debug.DrawRay(ray.origin, ray.direction * 100, Color.cyan);

    void FixedUpdate()
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit, 100))
            if (hit.collider.tag == "Terrain")
                Vector3 direction = hit.point - transform.position;
                ballRigid.AddForce(direction * force);

1 de jun. de 2017

LookAt2D(Vector 3)

A method to rotate a Gameobject towards a Vector3 position.
In the example bellow, the Tank´s Canon is following the Mouse.

Put this code in the object that you want to rotate. Call the method inside the Update().

void LookAt2D(Vector3 target) // target is the Vector to look at
        // Get point B based on point A as 0,0,0
        Vector3 targetDir = target - transform.position;

        // Use Tangent to get the Angle. 
        // Tan(x) = catetoOposto/catetoAdjacente
        float angleRad = Mathf.Atan2(targetDir.y, targetDir.x);
        // convert angle to Degrees
        float angleDeg = angleRad * Mathf.Rad2Deg;

        // I´ll rotate "angleDeg" in "Vector3.forward" Axis
        transform.rotation = Quaternion.AngleAxis(angleDeg, Vector3.forward);