Freitag, 14. Februar 2020

Unity 3d - change color - get current gameObject and change its color

image - see

using UnityEngine.UI;
public Image img;
img.color =; //

object - see

GetComponent<Renderer>().material.color =;

Unity 3d - get and set screen resolution


          Debug.Log("Screen Width : " + Screen.width);
    Debug.Log("Screen Height : " + Screen.height);



...where 1600 is the width, 900 the height and finally a boolean to signalize the fullscreen mode.

Dienstag, 11. Februar 2020

Unity 3d - c# Awake and Start methods


Awake() initializes private variables of an object once a startup.

When later on the object is gonna be enabled it will benefit of all settings made in Awake().
This will be unattended handled by Unity when the Start() script is being called.

Unity 3d - wait a few seconds / sleep

C# - How to wait a while in Unity 3d see
IEnumerator TimeRoutine()
       yield return new WaitForSeconds(3.0f); // wait 3 seconds within this TimeRoutine thread
       //load the next scene then for instance

Unity 3d - change scence how to

C#: how to switch to another scene in Unity 3d

using UnityEngine.SceneManagement;

get current scene name:


get Scene:

private Scene view;
this.view = SceneManager.GetActiveScene();