This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GameObject g = ..... | |
| g.GetComponent<Renderer>().material.color = new Color(color.r, color.g, color.b, color.a); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| namespace DependencyGraphSolver | |
| { | |
| public class DependencyGraphSolver | |
| { | |
| Dictionary<int, Node> nodes; | |
| public DependencyGraphSolver() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class SelfInstanciated : MonoBehaviour | |
| { | |
| [RuntimeInitializeOnLoadMethod] | |
| static void Init() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GameObject[] arrayOfGameObjects = GameObject.FindGameObjectsWithTag("tag that we wish to search for"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if(Input.GetKeyDown(KeyCode.Escape)) | |
| { | |
| Application.Quit(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Cursor.lockState = CursorLockMode.Locked; | |
| Cursor.visible = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEditor; | |
| using UnityEngine; | |
| //How can i run a script in at at edit time (Not Runtime) when object is selected, and recive user input (Edit update loop) ? | |
| //Editor scripts have to be in folder named Editor | |
| //[CustomEditor(typeof(GameObject))] ensures that this peace of code will run only when we have GameObject selected so we are save to cast object to GameObject [selectedTarget = (GameObject)target;] | |
| [CustomEditor(typeof(GameObject))] //This is custom editor for the type GameObject ( This script will kick in when we have game object selected ) | |
| public class CubeEditor : Editor | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GameObject instanciatedCube = (GameObject)PrefabUtility.InstantiatePrefab(Resources.Load("Cube")); | |
| //Prefab has to be in folder named Resources |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| import uuid | |
| import math | |
| import random | |
| def create_a_cube(name, position, set_rotation, scale): | |
| # Create a simple cube. | |
| bpy.ops.mesh.primitive_cube_add() | |
| # Get the cube object and rename it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| import uuid | |
| def create_a_cube(name, position, set_rotation, scale): | |
| # Create a simple cube. | |
| bpy.ops.mesh.primitive_cube_add() | |
| # Get the cube object and rename it. | |
| cube = bpy.context.object | |
| cube.name = name |