How to properly use blendshapes via script? (c#)
Hello, I need advice on how to script blendshape animations. What I try to do is, making a 25000 polygon female model blink with her eyes, in random intervals. The blendshapes are all showing up...
View ArticleBest method to set a random position on NavMesh? (c#)
Hello! Some time ago, I wrote a little method that finds and returns a random point on a plane or terrain the renderer.bounds.size-way. I use it to randomize my navMeshAgents destinations, to make them...
View ArticleMecanim ruins custom animations
Hello Community! I made a set of walk animations in Cinema 4d and in there they look acceptable for my needs. Problem is for whatever reason, the Mecanim avatar system doesn't seem to like my...
View ArticleHow to make builtin Component Inspector Settings available on Custom Component?
Hello, I have a portal script on an empty gameobject in the scene that spawns character prefabs with the 'NavMeshAgent' component attached. Is it possible to make certain builtin NavMeshAgent Settings...
View ArticleArgumentNullException when instantiating prefabs using generic list
Hi, I'm lost with this. I'm sure I did everything right but I get an 'ArgumentNullException: Argument cannot be null.'-error when I start the game. using UnityEngine; using System.Collections; using...
View ArticleLegacy Animation Walk Speed relative to Movement Speed
Hello, I am calculating the movement speed of a navmesh agent like this: float currentSpeed = 0; Vector3 currentPosition = Vector.zero; Vector3 lastFramePosition = Vector3.zero; void Awake() {...
View ArticleHow to store Gizmo (grid) Cube positions in Vector3 list at game start?
I have written this script to create a grid of gizmo cubes: using UnityEngine; using System.Collections.Generic; public class Grid : MonoBehaviour { public int[] rows; //public int[] columns; //not...
View ArticleNeed Help adding Main Color Property to a complicated Shader
Good day! I have gotten my hands on a great hair shader, the best i've ever seen so far. Now **I need to change the main color**, but I don't have a clue how this can be done. I googled a lot and tried...
View ArticleRandom.insideUnitSphere doesn't work as expected
Does anyone know why this snippet returns a position around world space zero? (the transform is a child) float radius = 5; float zDistance = 5; targetPosition = new Vector3(Random.insideUnitSphere.x *...
View ArticleConstant Transform Lerp
Is it bad practice to let a transform constantly re-position and rotate itself to a target with Vector3.Lerp and Quaternion.Lerp? For example: Camera.main.transform.position =...
View ArticleIncorrect usage of Vector3.Dot?
Hello, I am trying to make a game similar to Rimworld or Prison Architect, so I have a AI controlled sprite character with 4 different sprites for each main direction and I'm currently trying to...
View Articlezoom problem with GUI Box that follows a character
I have a GUI box following a sprite character in a 2d Top Down Game. If I zoom in, the GUI box goes up, if I zoom out, the GUI box moves down, instead of staying at the point it was drawn at game...
View ArticleArray = null when passing as parameter
Straight to the point. The following code is in a script that executes before all other scripts: public static AudioClip[] FootstepSounds; void Start() { FootstepSounds = Resources.LoadAll("Sound...
View ArticleHow to add one onClick Event to multiple UI buttons
Hello, I must be missing something essential here. This is what I've tried: void Start() { // Assign the callback to all buttons foreach(Button subbutton in canvas.transform.GetComponentsInChildren())...
View ArticleUnityEditor GenericMenu - Problem with 'AddItem' in Foreach Loop
I'm working on a custom inspector and I'm trying to populate a GenericMenu with the content of a string array like this: public override void OnInspectorGUI() { if(GUILayout.Button("Add Type")) { var...
View Article