Unity 3D – Intro about attributes and events .

This will update your component into visual area of Unity.
Some public variables will be fasioned and change with your selected attributes.
The attributes can be used into programming using the [] .
The class can have on top this attribute and is follow by the code source.
this will add a url

this will block drag and drop your component to just once.

this will block remove the component depend it TEST.

You can remove step by step , but when you add this also add both this component and the TEST component.
Many attributes use sections used to separate and show infos , like:
show word Details

make a space into Unity Inspector

show the header like Stats

this tell is a multiline for text area

renders a flexible textbox with a scrollbar.

create a slider from 0.0 to 360.0 for variable circle_angle

will be hide the public variables

this will execute the code , for example: you can execute the camera follow even you don’t use play mode.

this allow to run code GiveObject by create a menu on
Tools – Give object – Do it

then when play and used it this will run GiveObject

this gets serialized even though it is private

This can be a good example when you use sprites and colliders.
Example:

Then you need to use them and need to tell Unity something about your code

… and will show on development like a warning message “This one is old”

This part of the tutorial is more complex and is about events:
This attribute tell Unity can serializable something ( like: using events system ) .

Example with one serializable event:

I named the script , class and variable for event just to understand how this works.
You can use anything else for event : read_event_player, read_heat, read
You can change the name of the script or the class for event.
You can add Listener into your script and use them
NOTE: You can add new listeners to event, but you cannot see them in Unity Inspector.
Example: use Start area of code to add this:

then create this to use it:

If you take a look on Unity Inspector you don’t see this , just the print of Debug.Log
This events part is old but is ofen used by users.
You can use C# events and not the Unity events .
The Unity events is super powerfull for Unity development and is easy to use them.
If not you need to have some custom code for this type of tasks.
You can use something else into events (but not more 4 args) :

and use it

This is a little tricky but you can pass anything you want with events system.

Unity 3D – using the gyroscope.

If your tablet, phone or laptop has a gyroscope device then you can used with Unity 3D game engine.
Create your project and use this C# script to test and show info about your gyroscope device.

Android Studio – using SensorEventListener.

This tutorial is about programming android hardware sensors service: TYPE_ACCELEROMETER.
You can start by using last version of Android Studio version 3.1.1 with the default project Empty Activity.
Is very simple to use accelerometer with Android Studio by read the values and show us into the text view area.
The SensorEventListener is used to read this values.
The MainActivity will need work with: … implements SensorEventListener.
This example can be used also like a good way to learn about this issues.
Note:

  • the implements is a keyword specific to interfaces, whereas extends is used to inherit classes;
  •  a class must implement all methods of an interface, unless the class is declared as abstract.

You need to change the default text Hello World from activity_main.xml file with this:

Make changes into MainActivity.java file
The functions: onSensorChanged and onAccuracyChanged is not created by I.D.E. and can be created by code inspections when you write the source code.

The result is a text with the values of accelerometer of your hardware.

PowerShell tips – part 009.

Today I come with this simple tutorial about how to show logs from the last day.
The command is very simple and can be used with powershell and administrator command shell like this:

This command is build from Get-EventLog and parse by Get-Date, see options:

About AddDays is not only option you can use it.
You can get all of this options using this command: