Coderock

--------------------------------
link hover image

How to rotate object over time and oscillate

Frontpage calendar image November 29, 2016

I wanted to have an object rotate back and fourth between two specific angles on a single axis over time; it’s for a rocking 2D platform. public Vector3 from = new Vector3(0f, 0f, 135f); public Vector3 to = new Vector3(0f, 0f, 225f); public float speed = 1.0f; void Update() { float t = Mathf.PingPong(Time.time * […]

link hover image

Unity 2D How to hide a menu image in C#

Frontpage calendar image October 8, 2016

Get the reference to your specific button game object and set it to active or eactivate it using GameObject.SetActive(bool)

link hover image

Unity 2D dropdown selection in inspector

Frontpage calendar image October 6, 2016

public enum Car{ redneck,bike,mottor } public class SomeClass:MonoBehaviour{ public Car current; }

link hover image

Unity 2D Camera Zoom In Zoom Out

Frontpage calendar image October 5, 2016

Zoom Out: myCamera.orthographicSize = Mathf.MoveTowards(Camera.main.orthographicSize,18f,Time.deltaTime*2f);// 10; Zoom In: myCamera.orthographicSize = Mathf.Lerp(Camera.main.orthographicSize,2f,Time.deltaTime*0.3f);//4;

link hover image

Unity 2D: How can I let something happen after a small delay?

Frontpage calendar image October 2, 2016

You can do it with coroutines in any MonoBehaviour: IEnumerator ExecuteAfterTime(float time) { yield return new WaitForSeconds(time); // Code to execute after the delay } And you can call it with, for example StartCoroutine(ExecuteAfterTime(5));

link hover image

Unity 2D countdown timer (Clock ) script

Frontpage calendar image September 17, 2016

Create an object hierarchy; Create a script and attach it to an object; Access namespaces; Use the Update method; Rotate stuff based on time. Add script on clock: And clockAnimator script content: public Transform hours; private const float hoursToDegrees = 360f / 60f; float timeLeft = 45.0f; // Use this for initialization void Start () […]

link hover image

Visual Studio hot keys change occasionally, specifically F6 vs Ctrl-Shift-B for building

Frontpage calendar image January 9, 2016

You can reassign SHIFT + F6 to build the current project only: 1/ Go to Tools -> Options -> Environment -> Keyboard 2/ Show commands containing: Build.BuildSelection 3/ Focus the field Press shortcut keys & press Shift + F6 to assign it

link hover image

Crystal Reports: Formula editor window disappears

Frontpage calendar image January 7, 2016

If you are using a dual monitor or changing your monitor resolution, it is possible to ‘lose’ your Formula Editor. For Version 12, close Crystal Reports first and then follow these steps: Click the Start button and select “RUN” Type “Regedit” and Click “OK” Find the Registry key: HKEY_CURRENT_USERSoftwareBusiness ObjectsSuite 12.0 Crystal ReportsFormula Workshop Change […]

link hover image

How to Change Your WordPress Blog Password Using phpMyAdmin

Frontpage calendar image January 7, 2016

How to Change Your WordPress Blog Password Using phpMyAdmin:

link hover image

SQL: get previous from max value

Frontpage calendar image November 29, 2015

select max(card_no),vehicle_number FROM WBG.WBG_01_01 where card_no < (Select max(card_no) from WBG.WBG_01_01 group by vehicle_number) group by vehicle_number Source: stackoverflow