2019-02-18

Facebook Login for Unity

Sometimes we need to add "Facebook login" to identify a user on our game / app.

For that, its available the Facebook SDK, but also we need Openssl and java.

For the purpose of login in and getting scores, we can use a ver useful Asset, I use it, EasyLeaderBoard, and heres how to config:

1- Create your app on "Facebook developers page", and copy "APP id".

2- Go to Unity, menu "Facebook"-"Edit settings", and paste the app id. You will get two texts (package name and class name), copy and paste them on "Facebook developers page", and save changes.



*You can get an error on Unity saying "Openssl not found", or "Keytool not found", follow these steps: (from vfxjex at https://answers.unity.com/questions/616484/open-ssl-not-found.html)


1) Download and install OpenSSL. http://slproweb.com/products/Win32OpenSSL.html
 OpenSSL v#.#.# (not Light)











2) Add the OpenSSL directory to your path.

Go to: Control Panel > System > Advanced system settings > Environment Variables

Select the Variable "Path" in the "System variables" window and click Edit.

Add the path >> ";C:\Program Files\OpenSSL-Win64\bin"


3) If you get the "Keytool error", you need to add the JDK (Java Development Kit) bin directory to the Path variable value >>  JDK bin path. e.g. I added ";C:\Program Files\Java\jdk1.7.0_45\bin" to the end of the value text.

Restart Unity3D.
 

2019-01-29

Keyhash on Facebook Developers

In some apps we need to use a "Facebook login", for our apps or games in Unity. (setting scores, etc)

For that purpose, we must provide a "Hashkey" for our game to work, and put that keyhash on our Facebook developer page (https://developers.facebook.com/apps/YOURAPPID/settings/basic/)

¿how to get our app Hashkey?
with keytool command:
1: (install if not already, OpenSSL in c:\Openssl)
https://code.google.com/archive/p/openssl-for-windows/downloads
 2: (go to your jdk dir)  cd C:/Program Files/Java/jdk1.8.0_181/bin

3: keytool -exportcert -alias fq2 -keystore "C:\Users\joe\Documents\PATHKEYSTORE\APP.keystore" | C:\OpenSSL\bin\openssl sha1 -binary | C:\OpenSSL\bin\openssl base64


Thats it! You will get a 28 digit Hashkey, you must put it on your Facebook App on facebook:
https://developers.facebook.com/apps/YOURAPPID/settings/basic/


 (if your app says: " 28digit Hashkey not recognized" copy that "28digit" hashkey on the same facebook developer app.)

2018-12-26

Moving Projects

To move a project between Computers in Unity (i.e. Computer to laptop, etc) you can do it safely as is:

 
To copy / move a Unity project:
  1. Enable Version Control Meta Files in Editor Settings
    (This will add a .meta file for each file and folder in your project)
  2. When copying, do not copy the Library folder or the Temp folder (if at all exists).

  3. In most normal circumstances, you only need to copy the Assets and ProjectSettings folders.

    *After copying and opening in Unity, it will automatically generate the Library folder based on your meta files. 
 

2018-12-11

Fixing Intellisense in Visual Studio

There is a common issue on Visual Studio Community, used in Unity, when installing the first time:

Many times, it happened to me, Intellisense does not work inside Visual Studio.

Whats Intellisense?
- Its the autocomplete feature, when writing sentences, and its a basic feature for programming.



SOLUTION

Its hard to find a solution, but its easy to make:

1-  Close VS, if opened.

2- Enter your project folder, and delete .vs folder.
 
3- Then, open VS and it will require to install .NET features: do it, and restart your computer.

Now, problem solved.

Hope it helps to programmers.

Cheers!

Joseph Oli

2018-11-04

Fixing Android app "crash" when logging GoogleGamesServices ( Unity )

Sometimes you "Build and run" your Unity app on your mobile device and works fine but...
When login to "GoogleGamesServices" your app crashes.

Heres the solution, you must edit your AndroidManifest:

1) Open AndroidManifest: 
(inside "Project":  "GooglePlayGames / Plugins / Android /GooglePlayGamesManifest.plugin")

2) edit APP_ID in androidmanifest:

replace "\ " with "\u003

before:
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ 232323232323" />

after:
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\u003232323232323" />

Fixing "Build Failure:Unable to retrieve device properties" error (Unity)

Hi!

We are looking today to a disappointing Unity error, that shows sometimes when developing for Android devices.

When you try "Build and Run", sometimes you can get the following error: "Build Failure:Unable to retrieve device properties"

So, here´s the solution:

1- Kill adb.exe process   (ctrl+a+t+supr to open task manager, and "end task" "adb.exe")
2- Restart your android device.

Thats all, your Build and run should be running fine again.

Feel free to leave your comments!

regards!!!!

2018-10-28

Acceder al Text de un Objeto por C# -- Access "Text" property of an Object with script

SCROLL DOWN TO SEE IN ENGLISH

Hoy veremos como acceder / editar el "Text" de un GameObject, utilizando sólo C#, sin necesidad de utilizar el Inspector.

EJEMPLO:

Nombre del GameObject: titulo_opciones
Objetivo: modificar el texto.

1 - Muy sencillo, declaramos la variable al inicio
2 - Luego utilizaremos la segunda línea para buscar, mediante su nombre, el Gameobject.
* Dentro de la misma línea, le diremos que queremos su propiedad "Text" (podemos usar cualquier otra que tenga).
* Lo asignamos a nuestra variable (texto).
3 - En la tercera línea, le modificamos el valor y se reflejará automáticamente en nuestro programa.

       public Text texto;

       ...

       texto = GameObject.Find("titulo_opciones").GetComponent<Text>();

       texto.text = "Opciones";

 

ENGLISH
Today we will see how to access / edit the "Text" of a GameObject, using only C #, without using the Inspector.


EXAMPLE:

Name of the GameObject:
titulo_opciones

Goal: modify the text.


1 - Very simple, we declare the variable at the beginning (texto)

2 - Then we will use the second line to search, through its name, the Gameobject.

* Within the same line, we will tell that we want 
"Text" property (we can use any other that it has).

* We assign it to our variable (texto).

3 - In the third line, we modify the value and it will be automatically reflected in our program.

2018-10-16

Android permissions

* Don´t ask for permissions, android:
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />

(put it on: "GooglePlayGames/Plugins/Android/GooglePlayGamesManifest.plugin", 
inside "AndroidManifest")

2018-10-04

Google Play Game Services en Unity3D

Google Play Game Services en Unity3D:


How to Config:
1) Install in Unity (Import package):
https://github.com/playgameservices/play-games-plugin-for-unity
(current build)

2) Configure in unity: Window > Google Play Games > Setup > Android Setup

- Create "keystore" and save it (game.keystore).
- Get "SHA1" with "keytool" (see point 3).
- Create app/linked app/leaderboard un Google Play Console.


Constant Class: this can be whatever you want, just give it a name

Resource Definition: in your google play console, go to "game services" and to your app (or "Add New game".
 Select either leaderboards (marcadores) or achievements (create them if you've not set them up) and at the bottom you'll see the 'get resources' link. Click that (it will show new window) and paste it into the box in Unity.

Client ID: also in the game services, go down to linked apps (again, assuming you've already set this up) and click on your game from the list. At the bottom copy the string under "OAuth2 Client ID".


3) Code:
SPANISH:
http://edgargomez.es/unity3d-integrando-google-play-game-services/
ENGLISH:
Unity3D-GooglePlayGames-English

*Before Build*
1/2)
edit APP_ID in androidmanifest:

replace "\ " with "\u003

before:
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ 232323232323" />

after:
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\u003232323232323" />


DEBUG:
C:\Users\XX\AppData\Local\Android\Sdk\platform-tools> adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG

2/2)
*Be sure to uncheck "Development Build" in "File-Build settings", before build.

2018-09-18

Bienvenidos a / Welcome to...
                                                UNITY INTERNATIONAL GUIDE web!
ENGLISH? CHECK "TRANSLATE" ON RIGHT SIDE

Web ayuda y referencia para todos aquellos que ya programan o desean hacerlo en este entorno.
Help site for Unity3D developers.

Navega por el menú lateral de la derecha --------->
Browse on the right-side menu >>

Ya sabes qué es? si no es así, date una vuelta por aquí: http://www.unity3d.com

Saludos! Cheers!

Joseph.

Facebook Login for Unity

Sometimes we need to add " Facebook login " to identify a user on our game / app. For that, its available the Facebook SDK, but...