_id
int64
0
49
text
stringlengths
71
4.19k
0
Bounce with multiple collisions Here's the problem I'm writing an Arkanoid like game in Unity 5.3. I'm using 3D physics and simply ignoring z axis in computations. No gravity, 0 drag and velocity reset every bounce by script. My ball has sphere collider and rigidbody with continuous dynamic collision detection on it, and bricks have box colliders with continuous detection. They are set like tiles, one by one, without gaps. The problem occurs when a ball collides with two bricks at once, which causes a wrong bounce angle. Smaller sphere colliders makes this situation occur less often, but causes the ball to ignore collisions sometimes and phase through a single brick. I know the probable reason for this bug, I think a collision with two objects affects ball physics twice. The question is how to avoid it?
0
ArgumentException The Object you want to instantiate is null I am trying to copy data over from a binary file but when trying to instantiate a gameobject, it comes out as "null". static void LoadBuildings(SaveBuilding buildings) if (buildings.Length 0) return foreach(SaveBuilding b in buildings) if(b.type.ToString() "Farm") Farm build Instantiate(Resources.Load("Farm")) as Farm Debug.Log("Build " build) build.position.x b.positionX build.position.y b.positionY build.level b.level build.levelText build.GetComponentInChildren lt Text gt () The debug line shows there is no object and when the next line tries to execute I get an error ArgumentException The Object you want to instantiate is null. I initially had it as Farm build Instantiate(build.prefab) as Farm as I get an error "Use of unassigned local variable". I tried adding a prorperty above the if statement "GameObject build", I tried doing Farm build new Farm() above the if statement also but still get the initial error. I have a folder titled "Resources" and confirmed a prefab labelled "Farm" is there also. Could it have anything to do with the "static" prefix for the method?
0
How can i get component script from FirstPersonCharacter? In the Hierarchy i have a FPSController and as child of it FirstPersonCharacter. I can get script that attached to the FPSController but not from the FirstPersonCharacter. What i want to get is the Blur script from the FirstPersonCharacter. using System.Collections using System.Collections.Generic using UnityEngine using UnityStandardAssets.Characters.FirstPerson public class FadeScript MonoBehaviour public CharacterController firstPersonCharacter public FirstPersonController fpc public float fadeDuration 5 public float speed private Material material private float targetAlpha 0 private float lerpParam private float startAlpha 1 private bool rotated false void Start() material GetComponent lt Renderer gt ().material SetMaterialAlpha(1) fpc.enabled false void Update() lerpParam Time.deltaTime float alpha Mathf.Lerp(startAlpha, targetAlpha, lerpParam fadeDuration) SetMaterialAlpha(alpha) if (alpha 0) fpc.enabled true if (rotated false) fpc.GetComponent lt FirstPersonController gt ().enabled false fpc.transform.localRotation Quaternion.Slerp(fpc.transform.rotation, Quaternion.Euler(0, 0, 0), speed Time.deltaTime) if (fpc.transform.localRotation Quaternion.Euler(0,0,0)) fpc.GetComponent lt FirstPersonController gt ().enabled true firstPersonCharacter.GetComponent lt Blur gt rotated true public void FadeTo(float alpha, float duration) startAlpha material.color.a targetAlpha alpha fadeDuration duration lerpParam 0 private void SetMaterialAlpha(float alpha) Color color material.color color.a alpha material.color color I can get scripts from the FPSController like this fpc.GetComponent lt FirstPersonController gt ().enabled true But i can't get the Blur script from the firstPersonCharacter. I tried before instead public CharacterController firstPersonCharacter With GameObject public GameObject firstPersonCharacter But Blur is not exist. When i make GetComponent The Blur is not exist.
0
How can I have a value increase by multiples of 10 in the inspector? I have a number that I want to be editable in the inspector. However, I want to restrict that number to be a multiple of 10. I can always just go into the code and set it to the nearest multiple of 10, but I'd rather force it in the inspector. I am willing to use an int, float, Vector, or really any sort that can hold a number. How can I do this?
0
How to get a Vector2 location of an object? (Unity2D javascript) I need to make an "AI" that makes a ball try to touch the player. But Vector2.MoveTowards()needs a Vector2 variable but how do i get the location of an object?
0
When updating to Universal Render Pipeline an Error occurs I updated to the Universal Render Pipeline and despite of using the auto upgrade from project an error messages appears in the console. Here is the error In order to call GetTransformInfoExpectUpToDate, RendererUpdateManager.UpdateAll must be called first. UnityEngine.Rendering.RenderPipelineManager DoRenderLoop Internal(RenderPipelineAsset, IntPtr, AtomicSafetyHandle)
0
How do I hide UI canvas in c Unity3d? I want to display the final results at last in the game when gameobjects finish the winning(finish) line. For that I am using canvas and in that a panel onto which an image is attached. I have to hide that canvas at start of the game and then show when gameobjects cross the last finish line. How can I do this..? Please if anyone has an idea about this can help me. Thanks in advance )
0
Blurred sprite in Scene view The thread between the tree and the spider here is a LineRenderer. When the BackgroundLandscape or the Tree objects are selected it has this blur around the thread between the tree and the spider. When anything else is selected, it renders correctly. It always renders correctly in the Game view. What's causing this?
0
Unity Procedural Build Exe Creation I want to export ingame items to seperate data files. Those files should also be "openable" to display information about the item. My idea is to create every item as an .exe that will open a small windowed unity app with and image and some texts tabs. How would I handle this "procedural building of .exes" from within another application? For exeample I have a game with an inventory. And when I press "export to file", the item is build to an "item data exe file", that is then portable and openable as a standalone "item previewer". Thank you for help. For the start a general assessment of this idea could also be helpful.
0
Math.Clamp won't limit my position until movement is ceased The program is in a top down view, with Y going up (or forward depending upon how you see it), and X going from left to right based on the camera view. I am attempting to set the minimum and maximum values of my main character's x y axis movement through the float "clamp", under the struct "Mathf". When my ship passes the minimum maximum value on either axis, it doesn't stop it. If you release the movement key after passing the point, the character will appear directly on the minimum maximum point that was passed. See the gif below. Gif here http gph.is 22fdHv4 Below is the current script running for both player movement and the boundary, attached to the main character. using UnityEngine using System.Collections public class ShipMovement MonoBehaviour public float xMin public float xMax public float yMin public float yMax public float speed 2f public float shotSpeed 4f public float nextFire1 public float nextFire2 Animator anim public GameObject shot public Transform shotSpawn public float fireRate 0.25f void Start () anim GetComponent lt Animator gt () void FixedUpdate () GetComponent lt Rigidbody gt ().position new Vector3 ( Mathf.Clamp (transform.position.x, xMin, xMax ), Mathf.Clamp (transform.position.y, yMin, yMax), 0.0f ) if (Input.GetKey (KeyCode.W)) transform.Translate (Vector2.up speed Time.deltaTime) anim.SetBool ("moving", true) if (Input.GetKey (KeyCode.S)) transform.Translate (Vector2.down speed Time.deltaTime) anim.SetBool ("moving", true) if (Input.GetKey (KeyCode.A)) transform.Translate (Vector2.left speed Time.deltaTime) anim.SetBool ("moving", true) if (Input.GetKey (KeyCode.D)) transform.Translate (Vector2.right speed Time.deltaTime) anim.SetBool ("moving", true) else anim.SetBool ("moving", false) if (Input.GetKey (KeyCode.Space) amp amp Time.time gt nextFire1) nextFire1 Time.time fireRate Instantiate(shot, shotSpawn.position, shotSpawn.rotation) if (Input.GetKey (KeyCode.X) amp amp Time.time gt nextFire2) nextFire2 Time.time fireRate Instantiate (shot, shotSpawn.position, shotSpawn.rotation) if (gameObject null) Application.Quit () Although I am not sure, I suspect it may have something to with the way I am controlling the movement. I have had issues with what I have written in the past, especially with animations and moving left right while also moving up down. (Hence why I have all of the animation code commented out, and I am using a Capsule instead of a ship). If anything else is needed, I can provide it.
0
Use Mathf.PingPong() from current position I am trying to use Mathf.PingPong() from the current x, y and z coordinates and let it move along the x axis however now it moves too far and too fast. I know how I can speed down but what about the distance? transform.position new Vector3(transform.position.x Mathf.PingPong(Time.time speed, 1), transform.position.y, transform.position.z)
0
Player motion and combo systems Where do you usually implement player motion when going through the state machine of a combo system? An example, when player presses X Y it must do an uppercut like movement (Like street fighter) where the player jumps and hits. Another example could be the Devil may cry series where you can press down sword button and the enemy is thrown up and the player authomatically jumps to let player hit target in the air. When creating a combo, you have 2 things to take care of. One is the media that will be played when the combo is done (sound, animation, etc...) and the other the movement of the player when doing this combo. How do you handle the movement of the player? I have 2 posible options 1) Include the player motion (translation, rotatio, etc...) in the animation 2) Delegate the player motion to the combo nodes while they are being linked. First option could be the easiest but seems a bit restrictive. For example if you want to let the player do some other action while the current combo node media is playing (ej. jumping) could be tricky (Jump hit). Second option would need to have some many diffeernt nodes (We could use some kind of delegates here to minimize the node count(IOC)) to cover all the motion needs of every part of the combo. What do you think. Am I thinking too much? Cheers.
0
Ridiculous Error on Unity 5.6.4p4 Method Name doesn't exists I am facing a strange issue on Unity version 5.6.4p4 The code compiles and runs just perfectly fine in editor but when I build it for android I see an error message saying that my method doesn't exists. I have checked many times but there is no such issue. I am not doing anything wrong. Can anyone suggest what could be wrong ?
0
How do I make my character attack on the side of the character that I click the LMB on (Unity)? This is a top down game, I guess I should also mention that the character is not centred on the screen and the attack should be in 4 different directions. The attack's direction should be based on which side of the character(up, down, left, right) that you click on(this should also be universal on the screen, the only deciding factor should be the character and the mouse). I really have no clue where to start on this problem.
0
Shooting projectiles towards mouse position in Unity 2D I'm currently creating a scrip that handles the projectile movement and it's almost where I want it to be. Currently the script correctly instantiates the projectiles, moves the projectiles towards the mouse and deletes them off screen, but the speed of the projectile is not constant (faster or slower depending on how close the mouse is to the player) and after the projectile is fired, it follows the position of the mouse until it flies off screen. public class LetterController MonoBehaviour private List lt GameObject gt letters new List lt GameObject gt () public GameObject letterPrefab public float letterVelocity Vector3 direction void Update() direction Input.mousePosition direction.z 0.0f direction Camera.main.ScreenToWorldPoint(direction) direction direction transform.position if (Input.GetMouseButtonDown(0)) GameObject letter (GameObject)Instantiate(letterPrefab, transform.position,Quaternion.identity) letters.Add(letter) for (int i 0 i lt letters.Count i ) GameObject goLetter letters i if (goLetter ! null) goLetter.transform.Translate(direction Time.deltaTime letterVelocity) Vector3 letterScreenPosition Camera.main.WorldToScreenPoint(goLetter.transform.position) if (letterScreenPosition.y gt Screen.height letterScreenPosition.y lt 0 letterScreenPosition.x gt Screen.width 20 letterScreenPosition.x lt 20) DestroyObject(goLetter) letters.Remove(goLetter) I tried moving everything from Update() into a separate function called Shoot() and called that from Update(). I tried putting Vector3 direction in its own Vector3 function and calling it in goLetter.transform.Translate. I also tried using LateUpdate(). Nothing I've tired has made any significant changes to how the projectile interacts in Unity. I'd like to have the projectiles move at a constant speed and not follow the cursor but rather travel in a straight line anyone got any clues?
0
Child GameObject doesn't follow parent's transform Look at this picture first I have model that has sword in his hand. I added a cube named "Attack Collision" and located to blade position. And then set the hand to parent. But when the game starts, sword moves but it's children "Attack Collision" doesn't move at all. The funny thing is in the scene, I tried to move the "sword", but only it's children "Attack Collision" was moved. Seems like the sword is somekind of locked, because it's transform can be change but not applied at all, it's just stand still there and only it's children that made from Unity was moved like this I made this model and animation by Blender and imported to Unity as .FBX file. What am I missing?
0
Unity editor PropertyDrawer custom button I has a PropertyDrawer, everything goes fine, except one feature I can't figure out how to add button and I use checkbox instead using UnityEngine using UnityEditor using System.Collections CustomPropertyDrawer (typeof (InteractiveObject)) class InteractiveObjectPropertyDrawer PropertyDrawer public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) EditorGUI.BeginProperty (position, label, property) position EditorGUI.PrefixLabel (position, GUIUtility.GetControlID (FocusType.Passive), label) var indent EditorGUI.indentLevel EditorGUI.indentLevel 0 Rect colorRect new Rect (position.x, position.y, 40, position.height) Rect unitRect new Rect (position.x 50, position.y, 90, position.height) Rect nameRect new Rect (position.x 150, position.y, position.width 150, position.height) EditorGUI.BeginChangeCheck() EditorGUI.PropertyField (colorRect, property.FindPropertyRelative ("show"), GUIContent.none) if (EditorGUI.EndChangeCheck() ) RenderSettings.skybox.SetColor(" highlight", property.FindPropertyRelative ("id").colorValue) EditorGUI.PropertyField (unitRect, property.FindPropertyRelative ("name"), GUIContent.none) EditorGUI.PropertyField (nameRect, property.FindPropertyRelative ("name"), GUIContent.none) EditorGUI.indentLevel indent EditorGUI.EndProperty () How I can add button there?
0
Editor Window Show method is not working properly Documentation says that EditorWindow.Show show the EditorWindow. I have two classes public class WindowOne EditorWindow public static WindowOne windowOneInstance MenuItem("Window Open Window One") public static void Init() windowOneInstance GetWindow lt WindowOne gt (false, "Window One", true) and public class WindowTwo EditorWindow public static WindowTwo windowTwoInstance public static WindowOne windowOneInstance MenuItem("Window Open Window Two") public static void Init() windowTwoInstance GetWindow lt WindowTwo gt (false, "Window Two", true) windowOneInstance WindowOne.windowOneInstance public void OnGUI() if (GUI.Button(new Rect(0, 0, 200, 50), new GUIContent("show window one"))) windowOneInstance.Show() In menu I click Open Window One, then Open Window Two, then I close the first window Now if I click a Button on WindowTwo it doesn't show me WindowOne. Or at least it shows one pixel of window that I cannot move or resize or do something else. If I use GetWindow(typeof (WindowOne)) instead of .Show() it shows the window, but I'm not sure that it shows the same instance I created before, because instanceID of that window will be different. Why Show method works so strange? Am I doing something wrong? And what should I do to show the same instance of closed (temporarily hidden) window? Unity version 5.6.0p4
0
Add a placeholder text to the TextField This is my TextField EditorGUILayout.TextField("Placeholder Text", textfield, GUILayout.Height(35)) How can I add a placeholder text in my textfield that will be removed when I want to type in the field?
0
How do I raycast to detect which hexagonal tile was clicked? I want to detect the hexagonal tile a unit is on upon clicking on the unit. I was thinking of using a ray cast I can't get it to work. I'm trying to get the raycast to shoot from the bottom of the unit and change the material of the collided object. if (Input.GetMouseButtonDown (0)) Ray ray Camera.main.ScreenPointToRay(Input.mousePosition) RaycastHit hit if(Physics.Raycast(ray, out hit)) Debug.Log (hit) string hitTag hit.transform.tag if(hitTag "player") if(Physics.Raycast(user.transform.position,Vector3.down,10)) Debug.Log ("I'm on something!") hit.collider.renderer.material.color Color.red What might be going wrong?
0
Switching between VR and Desktop (VR Controllers are not tracked in Unity Build) I am developing a VR App in Unity3D for HTC Vive Pro (Wireless) everything works well with VR in the usual way. (SteamVR Plugin 2.5.0 (SDK 1.8.19)) Except for some requirement reasons in the same Unity scene, I have to shutdown VR switch to Desktop mode and later at some point enable VR again. The moment, I enable it via script the VR display is ON, the HMD tracking works well but the Vive controllers are not tracked (position amp rotation), I can see the controller model rendered though in the last position when the VR was shut down but I can't get the updated tracking. The issue is only happening in the Unity Build. In the editor, it is working fine now after this change. To fix the issue in the Unity Editor I tried changing the SteamVR ActivateActionSetOnLoad method from Start() to OnEnable() as the error on re enabling was related to controller actions missing, that is now fixed cause of this change. e g private void OnEnable() if (actionSet ! null amp amp activateOnStart) Debug.Log(string.Format(" SteamVR Activating 0 action set.", actionSet.fullPath)) actionSet.Activate(forSources, 0, disableAllOtherActionSets) I am looking for a solution, to fix the issue in the Unity build? Any suggestions are highly appreciated.
0
Creating Rope Physics for Unity I want to create a bungee jumping like game in Unity and therefore I need a rope physics. I especially need elastic ropes with capability to pull objects with velocity after a little extension. Do you know any place to start? Because I have no idea how to start such scripting. I looked at Asset Store. There are some rope physic simulators, but I have to do it on my own, plus they are really expensive. EDIT I already tried using Spring and or Configurable Joints in Unity, but they did not give what I want.
0
Creating a delay by using Invoke Is it possible to delay the effects of a script that is attached to a game object? I have 2 characters in a scene, both receiving live motion capture data, so they are both animated identically. I have rotated one by 180 degrees and placed it in front of the other one, to create the impression that they are copying mirroring each other. Each has several scripts attached to them, of course... Now, I would like to be able to delay one character a bit (e.g. 1 sec) to make it look more realistic, as if one character is observing the other character and then copying its exact movements. Is it possible to do this by somehow using the Invoke method on the other character's Update perhaps? Or any other possibilities to achieve what I described? EDIT I used a buffering mechanism, as suggested by all the helpful comments and answers, instead of delaying, because delaying would have resulted in the same network data being used, except after a delay, but I needed the same old data being used to animate a second character to create the impression of a delayed copying... private Queue lt Vector3 gt posQueue private Queue lt Quaternion gt rotQueue int delayedFrames 30 void Start() posQueue new Queue lt Vector3 gt () rotQueue new Queue lt Quaternion gt () void Update() Vector3 latestPositions Quaternion latestOrientations if (mvnActors.getLatestPose(actorID 1, out latestPositions, out latestOrientations)) posQueue.Enqueue(latestPositions) rotQueue.Enqueue(latestOrientations) if ((posQueue.Count gt delayedFrames) amp amp (rotQueue.Count gt delayedFrames)) Vector3 delayedPos posQueue.Dequeue() Quaternion delayedRot rotQueue.Dequeue() updateMvnActor(currentPose, delayedPos, delayedRot) updateModel(currentPose, targetModel)
0
Unity GPU Instancing with different textures? I'm making use of Unity's GPU Instancing in my 2D game and it really reduces draw calls significantly when using the same Material and same sprite (texture) on all batched gameObjects. I'm changing colors using MaterialPropertyBlock and everything works fine. But is there a way to do that with different sprites (textures) on batched gameObjects' material? What if I used a Sprite atlas to gather all sprites together, will that make GPU Instancing possible with different sprites? Material's Shader Shader quot Unlit UnlitTransparent quot Properties NoScaleOffset MainTex ( quot Texture quot , 2D) quot white quot quot PerRendererData quot this hides the property from the Material inspector (no performance impact, only hides property) PerRendererData BaseColor ( quot Color quot , Color) (1, 1, 1, 1) SubShader Tags quot Queue quot quot Transparent quot quot RenderType quot quot Transparent quot quot IgnoreProjector quot quot True quot quot CanUseSpriteAtlas quot quot True quot ZWrite OFF Blend SrcAlpha OneMinusSrcAlpha LOD 100 Pass CGPROGRAM pragma vertex vert pragma fragment frag make fog work pragma multi compile fog pragma multi compile instancing include quot UnityCG.cginc quot struct appdata float4 vertex POSITION float2 uv TEXCOORD0 UNITY VERTEX INPUT INSTANCE ID struct v2f float2 uv TEXCOORD0 UNITY FOG COORDS(1) float4 vertex SV POSITION UNITY VERTEX INPUT INSTANCE ID UNITY INSTANCING BUFFER START(Props) UNITY DEFINE INSTANCED PROP(fixed4, BaseColor) UNITY INSTANCING BUFFER END(Props) sampler2D MainTex float4 MainTex ST v2f vert (appdata v) v2f o UNITY SETUP INSTANCE ID(v) UNITY TRANSFER INSTANCE ID(v, o) o.vertex UnityObjectToClipPos(v.vertex) o.uv v.uv UNITY TRANSFER FOG(o,o.vertex) return o fixed4 frag (v2f i) SV Target UNITY SETUP INSTANCE ID(i) sample the texture fixed4 col tex2D( MainTex, i.uv) UNITY ACCESS INSTANCED PROP(Props, BaseColor) apply fog UNITY APPLY FOG(i.fogCoord, col) return col ENDCG
0
C Integer limits for Scriptable Objects I am experimenting with Scriptable Objects in Unity. In the following example how can I limit the range of accepted values? public class AScriptableObject ScriptableObject public uint damage Since it's a uint the lowest value is 0 but how can I limit the max value to 500 for example? Can I use if statements?
0
Is a custom coordinate system possible in Unity Is it possible to create a custom coordinate system (i.e the one using double for coordinates or the one dividing the world into 'chunks' of safe size) not constrained by the floating point precision limitations in Unity, and make systems using the built in coordinate system use that one instead somehow? Thanks!
0
Adding some new velocity to player in FixedUpdate. Should I use FixedDeltaTime or nothing? I am trying to learn how to move objects in Unity without using the built in features like AddForce etc. Some tutorials on Unity website (and other places) is where I have got most of my 'knowledge' so far from. This script for moving players (in topdown Space SHMUP) has been working fine for me and includes acceleration and artificial drag (basically 'smooth' movement, or like being on ice). I'm sure this code is overly long, bloated, inefficient and in most cases downright wrong, but it is written for me to understand it, rather than simply using Unity Prefabs and AssetPackages i download from Store. QUESTION Do I need the Time.fixedDeltaTime mutlipiers when calculating my 'delta v' values here. And also what about on the drag part at the bottom. As usual all help and comments are greatly appreciated. Thanks! public class Player Movement SpaceShooter TopDown MonoBehaviour public Vector2 maxVelocity public float drag public float moveForce private Rect moveBounds private Rigidbody2D rb private void Start() rb GetComponent lt Rigidbody2D gt () moveBounds Game Manager.instance.ScreenBounds private void FixedUpdate() float input h Input.GetAxis("Horizontal") float input v Input.GetAxis("Vertical") Vector2 delta v Vector2.zero delta v.x input h moveForce Time.fixedDeltaTime delta v.x Mathf.Clamp(delta v.x, maxVelocity.x, maxVelocity.x) delta v.y input v moveForce Time.fixedDeltaTime delta v.y Mathf.Clamp(delta v.y, maxVelocity.y, maxVelocity.y) Vector2 pos rb.position Vector2 vel rb.velocity if (pos.x lt moveBounds.xMin) pos.x moveBounds.xMin vel.x 0f if (pos.x gt moveBounds.xMax) pos.x moveBounds.xMax vel.x 0f if (pos.y lt moveBounds.yMin) pos.y moveBounds.yMin vel.y 0f if (pos.y gt moveBounds.yMax) pos.y moveBounds.yMax vel.y 0f rb.position pos rb.velocity vel delta v rb.velocity rb.velocity (1 Time.fixedDeltaTime drag) It appears to me that if FixedUpdate was somehow slowed down, the velocity would get changed slower, the same with the enemy movement but I don't know how that would effect the gameplay and if how the slowing down would occur
0
Unity, Steam and updaters! I am probably asking a question answered here already but I have yet to find the answer! Can anyone here help me with how updates work for your games? I know that through visual basic you can create batches to make shorter updates and everything like that but overall I am completely confused How to get your game from Unity to Steam and how can you update the version and files efficiently?
0
Camera position and angle different when running inside Unity and when running on Android On Windows, running Unity 4.6.1p5, my simple game with only a cube, camera and light looks like this but under Android (Gingerbread on a 5 inch Galaxy Player) the cube appears lower down, slightly different angle and smaller (relative to the screen size). Sorry couldn't get a screenshot with my screenshot app... Any ideas why please?
0
Best client server architecture for a mobile management game? For the past year I have worked on a small company that develops a traditional browser based strategy game, of the likes of Travian or Ogame, but using a more interactive approach like Tribal Wars 2. The game is made in a simple php server without frameworks and a simple mysql database, and all of the game happens in a single static page that is changed through ajax calls and has a map made in pixi.js. The automatic updates are delivered to the client side through polling the server which then queries some specific database tables made for the purpose for changes. While this approach is solid and works, it has 2 big problems Having a mobile app is increasingly more important and there are not enough resources for having two separate codebases. Having a app which is simply a wrapped webview is also not a solution because the performance of a really complex page with a giant webgl map is, while usable, really subpar Polling the server for changes creates a lot of programing challanges that make some simple tasks really complicated and creates a lot of convoluted code if we dont want to hurt the game performance, as we are not going make dozens of database queries every 5 seconds. I want to start developing a game idea that I have that is basically inserted in the same genre and which is going to be, at least initially, mobile only. The real problem here is that after reading a lot on the internet, I am confused on what should be a good client server architecture for me to start prototyping in a way that I do not run in the problems mentioned above. Basically, above all, I want the server to be able to know which page screen state is each client looking at, and be able to send them messages when another client changes something on that specific screen. It would also be nice if the solution is something lightweight on the server side to be able to scale a little. Client side I was thinking about Unity because of being cross platform, of all the environment around it (ads, analytics, a lot of support and answers on the internet), and because I have previous development experience with it. Server side is the real question. Simple http calls will not work and so PHP is out of the equation. I have though about using node.js with socket.io to use websockets solving the polling problem. Is this a good idea? Would it be better to store the game state in a relational or nosql database in this case? Would this work on unstable mobile conections? Lots of people seem to use a c and sockets for unity. Would this be overkill in this situation? Taking this approach how would the data be stored? would it be feasible with a linux server or would I need a windows server? Would this work on unstable mobile conections? Don't know, I'm open to suggestions. tl dr I want to make a mobile management game in unity but am confused what to choose for the server side architecture considering that I want the server to be ablose to send a message to the client without the client asking for it. Is there anything I should take in account? Sorry for the broad question and thanks for the help.
0
How to make player stay on a moving object I've made an obstacle course with various moving parts to test out movement of a player. In the obstacle course there is a section where there are multiple cubes moves from side to side, and you have to jump from one to the other. But regardless of their speed, I can't seem to get the player to stay on top of any of the moving cubes. I have no clue how to fix this my only guess would be to use materials, but I can't apply any to the character controller. I appreciate any suggestion that you can give. Also the movement is done as an animation that I created in unity in the animation window. Thanks, Nova
0
Issues with events changing game state I am currently experimenting with creating a turn based game using Unity and am trying to come up with a sensible architecture for structuring my game systems. So far I have decided to base everything around Game states. A game state represents a sort of "mode" of the gameplay, for instance "Select unit state" or "Game over state". A global game state manager holds a stack of these game states and can be called with pop (remove top game state), push (push the provided game state onto the stack) and replace all (pop all existing game states and push provided game state). Update is called on the top most element of the stack every logic frame. I also have Entities which exist on the scene and represent stuff like as game units, terrain, projectiles etc. These are standard gameObjects with behaviors, unity lifecycle etc. Finally there are a bunch of services which provide methods to handle stuff like menus and camera. The idea is that the game states handle the "logic" of the game such as player input, transitions between game states, calling the services and controlling modifying entities. I also use events to facilitate the communication between state, entities and systems to avoid coupling too much. These events are stuff like "Unit destroyed" and "Objective complete" which are listened to usually by entities, calls to move the camera, create entities and such are still called normally using the relevant service methods. Whilst this system works in theory I am having some issues with the interactions between events and game state logic. Consider the following Update of performActionState void update() Do something. Messanger.fireEvent(EventType.ACTION COMPLETE) GameSystemManager.pushState(new NewTurnState()) Objectives system listening for action complete void handleActionComplete() if (checkObjectivesAllComplete()) GameSystemManager.pushState(new GameCompleteState()) What I want to happen is for the objectives system to push a game complete state and finish the game. What actually happens is that the handle action complete pushes the game complete state, the rest of the perform action state update runs and a new turn state is pushed. The above example might be a bit simplistic but I see this as an underlying issue with my architecture. Most events would be fired due to a change in the state of the scene or completion of something, for instance a unit being destroyed or a unit entering a trigger area. The probability of the game logic needing to change state from the game states is quite high in these cases usually. I could easily fix the above sample in a number of ways, for instance I could move the checking of objectives into the start of NewGameState and invoke a pushGameState there instead to end the game but all the ways I can think of at the moment seem like hacks which will greatly increase coupling (New game state doesn't need to care about objectives) and code spaghetti. Any advice for ways I could potentially architecture around issues like this?
0
Why the main menu is not working on the second time when pressing on escape key to back to the main menu? I have two scenes. Main Menu and the main scene. The game start when only the main menu is loading. When I click on the New Game button it's loading the main scene and removing the main menu scene. If I click now on the Escape key it will remove the main scene and load back the main menu scene but this time I can't click on any of the buttons in the main menu. I'm not sure if this is the right way to switch between the scenes but it's not working good. On the Newgame button I created and attached a new script. And then in the OnClick event of the button I'm calling the method LoadByIndex using System.Collections using System.Collections.Generic using UnityEngine using UnityEngine.SceneManagement public class LoadSceneOnClick MonoBehaviour public void LoadByIndex(int sceneIndex) SceneManager.LoadScene(sceneIndex) On the main scene I added a empty gameobject and attached to it another script using System.Collections using System.Collections.Generic using UnityEngine public class BackToMainMenu MonoBehaviour public int sceneIndex Update is called once per frame void Update () if (Input.GetKeyDown(KeyCode.Escape)) UnityEngine.SceneManagement.SceneManager.LoadScene(sceneIndex) When the game start in the main menu when clicking on New Game button it's loading index 1 the main scene and removing the main menu. When clicking on escape key it's loading index 0 and removing the main scene. But then the main menu is not working.
0
Optimizing data structure for my text adventure? In my text adventure I'm making, I store the story data in a hashtable (I'm using unity's javascript unity script since I'm more comfortable with the syntax than C ). The problem is, the way I structure the hashtable means that it gets incredibly bloated very quickly (I've used the same structure in all of my text adventures across multiple languages. It quickly grows to nearly 1k lines long) which makes it hard to edit in the future (especially if I need to go back to edit certain parts later on) Here's the hashtable as it's currently structured public static var story "0" "text" "", "choices" "response1" "text" "", "nextPart" "1" , "response2" "text" "", "nextPart" "2" , "response3" "text" "", "nextPart" "3" , "1" "text" "", "lastPart" "0" , "2" "text" "", "lastPart" "0" If anyone could help me optimize the structure of the hashtable that'll make it so it's more easier for me to edit it in the future, that would be great Quick information for parts that may not be self explanatory "lastPart" indicates to the hashtable parser that the player has died and the number refers to the part where they chose the response choice. "nextPart" refers to the part of the story the response leads to.
0
How can I draw an outline in Unity3d? I am trying to highlight a rectangle of arbitrary height. I thought the easiest way to do this would be to create a separate "box" gameobject that outlines the rectangle. I've tried with both a MeshRenderer Transparent Texture, and a LineRenderer to outline the four points of the rectangle. Neither are very satisfactory. (Line renderer on in the middle, scaled cube on the right) What's the right way to go about this? I am trying to get something like the left rectangle a simple perimeter of fixed width through four points of my choosing.
0
Problem in player Rotation in Unity I am trying to rotate game camera using my android device orientation.Like this Using accelerometer input of device this may be done. But I don't know how to do this. I tried lot of methods, but failed. Anybody please help. I am using unity 5.3 with C .
0
Unity assets file structure I'm writing a map editor for a game built with Unity (5). I want to reuse as much of the resources from the game as possible. That means textures and meshes. I know they are somewhere in the assets files, but I need to be able to extract that data during runtime since I cannot (and do not want to) redistribute those files. Additionally, given that the game receives frequent updates, I need to be able to calculate the offsets each time the editor is started. I also need to know how the textures connect to the objects in the game. In order to do that, I need to know what the structure of assets file is, or at least find a way to extract them all and then use hex editor to figure out how they're put together. I know there is a devxdevelopment tool that can do the latter, but I don't really have any money to spend on this. Can you give me any info or pointers that would enable me to figure this out?
0
Mouse click movement I need to make realistic human movement (3D) using mouse click. Get mouse click point using Raycast. Smoothly Slerp to LookRotation. Move transform.forward. Everything works fine, except I have problem with circular movement (close radius). Example If dont move transform.forward while Slerp to LookRotation or MoveTowards instead of transform.forward it will be spinning like whirligig on circular movement. Example If do move transform.forward while while Slerp to LookRotation it will distort trajectory of straight direct movement. Is there any solution to move circular realistic (not spin like whirligig) and move straight direct when needed (not distort trajectory)? I need straight movement from first example and circular movement from second. if (Input.GetMouseButtonDown(1)) Ray ray Camera.main.ScreenPointToRay(Input.mousePosition) RaycastHit hits Physics.RaycastAll(ray) foreach (RaycastHit hit in hits) if (hit.transform.tag "Ground") DestinationPosition new Vector3(hit.point.x, transform.position.y, hit.point.z) DestinationRotation Quaternion.LookRotation(DestinationPosition transform.position) break if (Vector3.Distance(transform.position, DestinationPosition) gt 1) transform.rotation Quaternion.Slerp(transform.rotation, DestinationRotation, RotationSpeed Time.deltaTime) transform.position transform.forward MovementSpeed Time.deltaTime transform.position Vector3.MoveTowards(transform.position, DestinationPosition, MovementSpeed Time.deltaTime) animation.CrossFade("run") else animation.CrossFade("idle")
0
Mixamo Fuse Unity eyelashes not correct I created a character in Adobe Fuse, sent it to Mixamo for rigging with blendshapes and downloaded the fbx for unity file. Below is how the character eyelashes appear in Fuse.. However, when I imported the fbx file and pulled it in my scene, the eyelashes appear as a piece of block. How do I fix this? EDIT It seems like the eyelashes are messed up due to Mixamo, there is no issue with Unity import. It happens when the Fuse character is sent to Mixamo for rigging and downloaded from there. When I opened the downloaded fbx file in Windows 3dViewer, it appeared with messes up eyelashes as shown below. EDIT Added the texture material option pane, material settings and import settings for albedo texture in Unity below
0
Moving object parallel to another on path on 2d space How to Move object parallel to another on curved path on 2d space
0
Unable to Merge Android manifest error is showing up I used Google Admob to put ads in my game but as soon as I hit build and run this error showed up I used a Github file and imported into my unity project, I will link it right here https github.com unity plugins Unity Admob. CommandInvokationFailure Unable to merge android manifests. See the Console for more details. C Program Files (x86) Java jdk1.8.0 101 bin java.exe Xmx1024M Dcom.android.sdkmanager.toolsdir "C Users jayso AppData Local Android android sdk tools" Dfile.encoding UTF8 jar "C Program Files Unity Editor Data PlaybackEngines AndroidPlayer Tools sdktools.jar" stderr Error Temp StagingArea AndroidManifest main.xml 21, C Users jayso OneDrive Documents Tap Happy Temp StagingArea android libraries play services ads 10.2.0 AndroidManifest.xml 2 Main manifest has but library uses minSdkVersion '14' Error Temp StagingArea AndroidManifest main.xml 21, C Users jayso OneDrive Documents Tap Happy Temp StagingArea android libraries play services ads lite 10.2.0 AndroidManifest.xml 7 Main manifest has but library uses minSdkVersion '14' Error Temp StagingArea AndroidManifest main.xml 21, C Users jayso OneDrive Documents Tap Happy Temp StagingArea android libraries play services base 10.2.0 AndroidManifest.xml 2 Main manifest has but library uses minSdkVersion '14' Error Temp StagingArea AndroidManifest main.xml 21, C Users jayso OneDrive Documents Tap Happy Temp StagingArea android libraries play services basement 10.2.0 AndroidManifest.xml 2 Main manifest has but library uses minSdkVersion '14' Error Temp StagingArea AndroidManifest main.xml 21, C Users jayso OneDrive Documents Tap Happy Temp StagingArea android libraries play services gass 10.2.0 AndroidManifest.xml 2 Main manifest has but library uses minSdkVersion '14' Error Temp StagingArea AndroidManifest main.xml 21, C Users jayso OneDrive Documents Tap Happy Temp StagingArea android libraries play services tasks 10.2.0 AndroidManifest.xml 2 Main manifest has but library uses minSdkVersion '14' stdout exit code 1 UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.BuildPlayerWindow BuildPlayerAndRun()
0
how to modify multiples BoxCollider on a same game object? I have an game object with multiples BoxCollider attached to it, is there a way to get all the BoxCollider to an array so that I could modify their value individually ?
0
Make the texture array node work with cubemaps? I am working on a procedural interior mapping shader in Unity's Shader Graph. Ideally, I'd like to feed it a set of cubemaps it can pick from semi randomly. However, it seems that by default the texture array asset one can provide to a graph does not support reading cubemaps. Does anyone have a way to use this, or perhaps a clever custom node or alternate texture mapping, so that I can read a number of cubemaps into the shader semi randomly? Preferably an arbitrary number, but even a fixed number would be somewhat of an improvement.
0
How to increase or decrease the speed of a gameObject after solving a puzzle? I am new to unity development and I am trying to make a script where the game player needs to solve puzzles to keep an object moving. How can I make the player increase decrease this velocity after solving a challenge? Thanks in advance. Edit 1 I just started with this code to control a Sphere using the arrows public class PlayerController MonoBehaviour public float speed private Rigidbody rb void Start () rb GetComponent lt Rigidbody gt () void FixedUpdate () float moveHorizontal Input.GetAxis ("Horizontal") float moveVertical Input.GetAxis ("Vertical") Vector3 movement new Vector3 (moveHorizontal, 0.0f, moveVertical) rb.AddForce (movement speed) I am thinking to try a method like velocityIncrease that will act after a condition statement like isPuzzleSolved. My intention is to handle the Sphere after getting some points during the puzzle. It will keeps the ball rolling until it reach its goal. My screen will be divided on a field where the ball stays and on the bottom of the screen I need to put an area for the puzzle solving. Thanks to reply.
0
Why Godot over Cryengine, UE4, Armory3d or Unity3d? Godot have a low performance in linux systems and lack of functionalities? This appear not been in account when peoples vote for him over other engines and i wonther whi. I know it is under MIT lisence, but the others engines have a very permisive licences and in some cases they help you with funding for your games. I ask this because i have maded survey on google plus about a selection of engines, and people still bote for godot over other engines. I want to select an engine for my future games, and when i compared, godot's not get a good place.
0
Unity Webgl build fast in Chrome, slow in Firefox, Opera and Edge Good day. I've a Chrome 'factory default' settings that can Run my unity webgl app fast, without problem (between 40 and 60fps). Same app run at 1 fps in others browsers edge, firefox and opera. What can I check to solve ? Thanks
0
unable to send or update data into my mysql database using unity I am trying to save user scores into my data base so i have deveoped backend on php and mysql datbase. All the things are complete but having issues to send or receive data through my unity WWW class. Here is my C code to get and send data to php and then DB using UnityEngine using System.Collections public class Scripts MonoBehaviour string dataSubmitURL "http localhost HighScore AddScore.php?" string dataGetURL "http localhost HighScore GetScore.php" Use this for initialization void Start () StartCoroutine(GetScores()) StartCoroutine(PostScores("faizan",100)) Update is called once per frame void Update () IEnumerator PostScores(string playerName, int score) string submitURL dataSubmitURL "name " playerName " amp score " score print(submitURL) WWW submitData new WWW(submitURL) yield return submitData if (submitData.error ! null) Debug.LogError("Error occur when Submitting data " submitData.error) Debug.LogError("Error occur when Submitting data " submitData.text) Debug.LogError("Error occur when Submitting data " submitData.responseHeaders) submitData.text else print(" Submitted") IEnumerator GetScores() WWW getData new WWW(dataGetURL) yield return getData if (getData.error ! null) Debug.LogError("There was an error getting the high score " getData.error) else print(getData.text) If i directly run my urls into browser string dataGetURL "http localhost HighScore GetScore.php" then it is working perfectly and giving me data but same thing when i trying through my c www(above code) then it reply. There was an error getting the high score Empty reply from server
0
Project 360 video on the inside of a iso sphere polygon sphere I'm creating a game in Unity. I have a iso sphere or polygon sphere, and I want to project a 360 video on the inside of the polygon sphere. I've learned thow to put a 360 video on the inside of a sphere, following this thread, but how can I do it inside a polygon sphere, since the 360 video was created based on a sphere but not a polygon sphere? Shader "Flip Normals" Properties MainTex ("Base (RGB)", 2D) "white" SubShader Tags "RenderType" "Opaque" Cull Off CGPROGRAM pragma surface surf Lambert vertex vert sampler2D MainTex struct Input float2 uv MainTex float4 color COLOR void vert(inout appdata full v) v.normal.xyz v.normal 1 void surf (Input IN, inout SurfaceOutput o) fixed3 result tex2D( MainTex, IN.uv MainTex) o.Albedo result.rgb o.Alpha 1 ENDCG Fallback "Diffuse"
0
What GameEngine to choose I concider myself an amateur, but I have quite some experince in Unity3D. Over the course of the next three years before I can quit my job and go to colledge I want to make ONE game. Now the question that bothers me is which gameengine to choose A) Unity3D, because I know it well and the community is great (even though I didn't touch it for a year or so) B) GoDotEngine, because it's open source, still beeing improved and very lightweight C) Blender, because Python (though..who really uses blender for games? and I kinda hate blender) Initially I wanted to go with GoDot, since it is a lot like Unity and OpenSource, but I fear that the community is to small to help me out, if I get stuck and I really need to finish this, if I want to spend three years on it.
0
How can I dissolve using dynamic mask objects? I want to Implement dissolve shader like this youtube video as you can see minions projected light on house to burning it out. I like to know how to make a similar effect.
0
How to stop camera from rotating in 2.5d platformer I'm stuck with a problem I can not make my camera stop rotating after character. What I already have tried using empty game object with rigid body and locked rotation and make it parent of camera, while player being the parent of object. Also, I've tried using few scripts from web, that did not help. Right now I'm bad with using JS in Unity (can handle JS on website, but I dont know how to integrate it for now) and practicing the basics, making easy 2.5d platformer with basic features, so I can not write code for now.
0
Accessing a UI Image that is a child of a GameObject? I'm sure there is a very simple solution to this issue. I am creating a UI for a 2D RPG in Unity. I have a Canvas with a two GameObjects DialogManager amp MenuManager The Dialog Manager has a child "DialogBox" which is a UI Image. And the Menu Manager has three children for each part of the menu, so three UI Images. How the heck do I access these UI Images in a script attached to a different gameObject? Since they're technically not gameObjects, I can't just use the old gameObject.Find(). I've seen some things about Transforms and Children, but I just can't wrap my head around it.
0
Is it possible to have a GUI in world space in Unity3D game? I'm trying to make a tank shooter game for learning purpose and I want to have it viewed in first person, is there a way to make it so that the GUI seems projected onto the interior of the tank chamber so that I can look around without the GUI following the camera along with having the perspective change effects (i.e. the edge of the GUI further away from the camera appears smaller than the edge closer to the center of the camera)?
0
How to make high quality gifs of Unity game play I've seen several Unity game play gifs, mostly on twitter. Are there any tools for making high quality gifs in Unity that are quite flexible? For example, I video recording tool that captures the game window and allows users to make gifs of portions, possible specifying the desired quality. Generally, I am looking for a tool that is quite flexible (has a lot of options for capturing gifs) and possibly game window video. UPDATE Some examples are here and here. Generally, several of the gifs that are hash tagged madewithunity a really high quality.
0
Unity Material Override Video is too dark I have made a TV in Blender, UV Wrapped a material and applied a video on it in Unity. But the picture is too dark, and I would like to make it brighter. How could I solve this problem? The left one
0
Procedural Islands Voronoi Pattern I'm trying to keep this as simple as possible, as I've found out the last few days this is a very difficult topic. I'd like to generate multiple flat islands, formed by a voronoi diagram. I've followed a long and (for me) difficult tutorial of building a procedural hexagonal grid just to find out it looks to artificial. I'd like to create a plane with faces divided in a voronoi diagram, and extrude multiple groups upwards to create islands. With that I'd like to achieve something similar as this http applemagazine.com wp content uploads 2015 10 image2.jpg Please help to get me started in the right direction, since my approach might be wrong in itself. EDIT I've found this https github.com jceipek Unity delaunay. Which draws lines in a voronoi diagram. Now I'm guessing the next step is to convert this to a mesh. Then I'd have to highlight random faces to be extruded to create the islands. Maybe this could be done with perlin noise, which I've just learned about. Extruding might not be the best way. Maybe deleting the faces that won't be land, and creating fall of edges (Like Wardy said). I'm doing my best to figure this out on my own, but any help is greatly appreciated.
0
How to move player on unity3D? I checked the input settings. I added a speed value. I also added Time.deltaTime, but the body is not moving. using UnityEngine using System.Collections public class PlayerController MonoBehaviour public float speed private Rigidbody rb void Start () rb GetComponent lt Rigidbody gt () void FixedUpdate () float moveHorizontal Input.GetAxis("Horizontal") float moveVertical Input.GetAxis("Vertical") Vector3 movement new Vector3(moveHorizontal, 0.0f, moveVertical) rb.AddForce(movement speed)
0
Set box collider size in meters instead of percents TL DR Can I set the size of a collider in meters instead of fractions of the size of the object it's in? I'm implementing a classic NES game, and my scale is 1 meter 16 pixels. I have an 8x1x1m prism with a rigidbody, and I need its box collider to be smaller than it by one pixel on every side to have the dimensions (8 1 16 1 16) x (1 1 16 1 16) x (1 1 16 1 16). (I'm subtracting the width of two pixels from each dimension because each dimension corresponds to two sides.) When I set the size of the collider to (0.5, 1, 1), though, it interprets those numbers as fractions of the size of the prism instead of as meters. This results in a 4x1x1m collider instead of a 0.5x1x1m collider. Is there a way I can set the size in meters instead of percents? I'll save me a little bit of math, and, more importantly, it could prevent some floating point errors, especially if I switch to a scale with more pixels per meter.
0
Changes to one Unity trail renderer causes all of them to flicker I'm using Unity. So I have a prefab, and this prefab has a trail renderer component attached to it. However, for some of the game objects I want to stop the trailer renderer at certain points in time. But doing so seems to make all of the trail renderers blink flash off and on. I've tried changing time, disabling the component, and using Clear() while hiding the trail renderer behind the background before needing to be used. All of these makes all trail renderers flicker on the frame the change happens. I believe providing the code won't be helpful, it's just if(x) disable action, if(y) enable action. What can I do?
0
Need some help with Unity 2d animation controller So my animations don't transition right. I have a 2d top down prototype project and animations for 4 directional movement and an idle position. Right now i have the movement set up so the right animation activates when the player moves in one of 4 directions. problem is that the walking animation does not stop when the player stops, it doesn't transition over to the idle animation. My animation controller looks like this The parameter between the animations are an integer that signals which direction needs to play, from 0 to 3. I have been messing around with a speed float parameter, but I don't really know how to get it to work. if (Input.GetKey (KeyCode.D)) GetComponent lt Rigidbody2D gt ().velocity new Vector2(moveSpeed,GetComponent lt Rigidbody2D gt ().velocity.y) animator.SetInteger("Direction", 2) animator.SetFloat("MoveSpeed", 0) if (Input.GetKey(KeyCode.A)) GetComponent lt Rigidbody2D gt ().velocity new Vector2( moveSpeed, GetComponent lt Rigidbody2D gt ().velocity.y) animator.SetInteger("Direction", 0) animator.SetFloat("MoveSpeed", 0) if (Input.GetKey(KeyCode.W)) GetComponent lt Rigidbody2D gt ().velocity new Vector2(GetComponent lt Rigidbody2D gt ().velocity.x, moveSpeed) animator.SetInteger("Direction", 1) animator.SetFloat("MoveSpeed", 0) if (Input.GetKey(KeyCode.S)) GetComponent lt Rigidbody2D gt ().velocity new Vector2(GetComponent lt Rigidbody2D gt ().velocity.x, moveSpeed) animator.SetInteger("Direction", 3) animator.SetFloat("MoveSpeed", 0) Here is my movement code if it helps. If I'm missing something important that you need to help me, please tell me.
0
Unity text is very blurry. How can I fix it? Unity text is very blurry. How can I fix it? To be honest, I have no idea why it behaves this way Hope that someone faced the same problem and will be able to share how it was tackled.
0
Unity InputSystem using Unity Events not maintaining values I am testing out using the new Input System and cannot get the values from context.ReadValue lt Vector2 gt () to pass into a private variable. The simple setup is below using UnityEngine using UnityEngine.InputSystem public class PlayerController MonoBehaviour Vector2 leftThumbstickValues void Start() leftThumbstickValues Vector2.zero void FixedUpdate() Debug.Log( quot FixedUpdate quot leftThumbstickValues) Always displays quot FixedUpdate (0.0, 0.0) quot public void Move(InputAction.CallbackContext context) leftThumbstickValues context.ReadValue lt Vector2 gt () Debug.Log( quot Move quot leftThumbstickValues) Displays correct values As you can see, in the Move function it correctly pulls the values from the thumbstick, but when it tries to use the values in FixedUpdate it always equals Vector2.zero. It seems like it should just work, but I think I must have overlooked something very simple. Player Input Settings Input Action Move Properties Input Action Left Stick Properties EDIT I decided to remove the Player Input component and subscribe to the events in code controls.Player.Move.performed cntxt gt Move(cntxt) controls.Player.Move.canceled cntxt gt leftThumbstickValues Vector2.zero This now works as expected. I'm not sure I should mark this as the answer though as it doesn't explain why it doesn't work with the original setup, just offers an alternative solution.
0
Making a cube slowly rotate 180 degress one time on a mouseclick I am new to C and new to Unity. I made a script that can turn a cube slowly one time after a mouse click but I feel like its probably wrong for using FixedUpdate. Is this OK or is there a better way? What is wrong with this way? using UnityEngine using System.Collections public class MouseClick MonoBehaviour public float myRotationSpeed 1.0f bool flipped false when User clicks it with mouse void OnMouseDown () if (flipped false) flipped true void FixedUpdate () if(flipped true amp amp gameObject.transform.rotation.y gt 0.01) transform.Rotate(0, myRotationSpeed Time.deltaTime, 0)
0
How do I save variables and load them in Unity with JavaScript? I made a game and i want to save the high score and load it back. I need to save 3 variables and load them when the game starts. How do i do it?
0
Why do I need to offset my aim rotation angle by 90 degrees? I have this simple code to rotate an object (gun barrel) towards a target object (rocket ship). The gun barrel rotates towards the ship but is always 90 degrees off. I have fixed this in my code as you can see by subtracting 90 degrees from the angle but I would like to know why it is happening and if there is a more elegant solution. I have checked the rotation of all objects involved but that doesn't seem to change anything. Any help is much appreciated! using UnityEngine public class RotateTowardsObject MonoBehaviour public float speed 5f how fast this rotates towards the target public Transform target target to follow public void Update() Vector2 direction target.position transform.position direction between this position and target position float angle Mathf.Atan2(direction.y, direction.x) Mathf.Rad2Deg calculate the angle angle angle 90f Temporary fix(?) for rotation being 90 degrees off Quaternion rotation Quaternion.AngleAxis(angle, Vector3.forward) create rotation from quaternion transform.rotation Quaternion.Slerp(transform.rotation, rotation, speed Time.deltaTime) set rotation acceleration towards target
0
Unity Loading Image? I have a quastion about loading screen in unity. I don't want to make a scene between to levels Main Menu Loading Scene Game level . I want to use Canvas "Image"that run at the start of the game level and then disappear after few seconds Main Menu Game level . Is this good idea ?
0
How do I make an object not appear grey regardless of distance? My moon texture is on a plane 500m away and I would like to know if there is a way to keep displaying the texture As opposed to it turning grey as pictured here regardless of the distance it is from the camera. Any help is greatly appreciated, Thanks.
0
Unity3D Mathf Lerp too fast when timescale increases I have an image with a fill amount component controlled by a Mathf Lerp. The problem is, the time for completion of the Mathf Lerp function decreases more than expected when the timescale increases. When the timescale is equal to 2 the function should take half the time to complete but it takes less than that. Any idea why? public static float demolishTime 6.0f public void OnClickDemolish() InvokeRepeating("demolishProgress", 0f, 0.1f) void demolishProgress() progress (Time.deltaTime demolishTime) demolishProgressBar DemolishManager.demolishState .fillAmount (float)Mathf.Lerp(0, 1, progress) if (progress gt 1) demolishCompleted()
0
Unity application freezes on ios at pause When I play my game made with Unity on iOS device, and press the home button or let the screen close by time or by pressing the power button and then try to come back to the game, the game freezes immediately. This does not happen always, only when there's certain things happened in the game in the current session. I have found nothing in common in between these situations. If those events have not happened in the current session, I can go to home screen and play other games and come back to the game and continue where I left without issues. I have tried debugging on xcode, with no output whatsoever in the console regarding this issue. XCode reports 200mb memory usage and Unity profiler reports roughly 300mb memory usage when going to the pause state, and nothing happens when coming back to the game. We have had memory issues previously which we have been optimizing a lot lately, but this particular crash is still persisting. Android works fine, whaterver the device memory capacity is. I have been trying to google for this type of iOS crash, with no luck. I'm asking here if someone might have some advice or direction for me to go to. EDIT I updated the question to match my current situation. I previously had some code in this question and talks about memory issues, which I have found out to have nothing to do with the problem at hand. What happens according to the debug console in XCode Home button is pressed OnApplicationPause(true) gets called One Update() gets called GameAnalytics detects a status change (headingToBackground event) and ends session User is at home screen, resuming game by tapping on the game icon GameAnalytics gets a headingToForeground event and restarts the session Nothing else happens after that This makes me want to point my finger at GameAnalytics, but why it works sometimes, just not after these specific events?
0
Make 2d sprite move in unity At the moment I have a movement script which moves my player in Bothe directions but it only faces 1 way using System.Collections using System.Collections.Generic using UnityEngine public class Movement MonoBehaviour public float moveSpeed 5f Start is called before the first frame update void Start() Update is called once per frame void Update() Jump() Vector3 movement new Vector3(Input.GetAxis( quot Horizontal quot ), 0f, 0f) transform.position movement Time.deltaTime moveSpeed void Jump() if (Input.GetButtonDown( quot Jump quot )) gameObject.GetComponent lt Rigidbody2D gt ().AddForce(new Vector2(0f, 5f), ForceMode2D.Impulse) How can I make the sprite face the other way when I move west not east?
0
How can I change the splash screen for a standalone game in Unity3D? I want to change the normal Unity splash screen to be customized for my game and every time I change the splash image in the player setting it does not appear. So how can I do that please?
0
Unity blur only selected layers I'm messing around with Unity 2017's post processing tools while making a 2D game that benefits from the parallaxing effect using a perspective camera. Please note that the game is mostly made using sprites. Now, I have a playerGround, a backGround and a foreGround. I wish to blur the background and foreground only but not the playerground. I'd like to know how to do this as playing with the focal length didn't do anything, everything receives the same blur amount regardless of the distance from camera.
0
Is Unity 2017 random number generator deterministic across platforms given the same initial seed? Is unity engines random number generator deterministic across platforms given the same initial seed or should I implement my own? I know there have been some modifications to the random number generator recently. Answers are appreciated, I don't have the devices on hand to perform any tests and I haven't yet found a direct statement on the matter.
0
Does Unity3D custom shader use its default GPU or CPU skinning automatically? I'm writing my own shader in mobile, but was wondering if it uses default GPU or CPU skinning feature in Unity3D? I'd like to use GPU skinning and already enabled GPU skinning. Is there any way to determine which (GPU or CPU) was actually used? My shader is as below Shader "Mobile Custom Specular Map" Properties ShininessColor("Shininess Color", Color) (1,1,1,1) Shininess ("Shininess", Range (0.03, 1)) 0.078125 MainTex ("Base (RGB)", 2D) "white" SpecMap ("Specular Map", 2D) "white" SubShader Tags "RenderType" "Opaque" LOD 250 Cull Back CGPROGRAM pragma surface surf MobileBlinnPhong exclude path prepass nolightmap halfasview interpolateview noshadow nofog nometa nolppv noshadowmask inline fixed4 LightingMobileBlinnPhong (SurfaceOutput s, fixed3 lightDir, fixed3 halfDir, fixed atten) fixed diff max (0, dot (s.Normal, lightDir)) fixed nh max (0, dot (s.Normal, halfDir)) fixed spec pow (nh, s.Specular 128) s.Gloss fixed4 c c.rgb (s.Albedo LightColor0.rgb diff LightColor0.rgb spec) atten UNITY OPAQUE ALPHA(c.a) return c sampler2D MainTex sampler2D SpecMap uniform float4 ShininessColor half Shininess struct Input float2 uv MainTex void surf (Input IN, inout SurfaceOutput o) fixed4 tex tex2D( MainTex, IN.uv MainTex) o.Albedo tex.rgb o.Gloss tex2D( SpecMap, IN.uv MainTex) ShininessColor o.Alpha tex.a o.Specular Shininess ENDCG FallBack "Mobile VertexLit"
0
How do you reference one game object from another? I am trying to reference a game object that was created in the editor and added to the scene (not created dynamically). How can I reference this object in a script added to another gameobject? For example I have a Mesh called QuantumCold B (in the editor), and I try to get its position in a script to be added to First Person Player, but instead I get Unknown identifier ('QuantumCold B'). Here is my script function Update () transform.RotateAround(QuantumCold B.position, Vector2,20 Time.deltaTime) Also is position the right way to get the Vector position on QuantumCold B?
0
implementing daily challenges in games I want to know how can I define daily monthly challenges in my game? Is this something can be defined locally or its need server and external services? And which servers and technologies can implements that? Is persistent connection or needed as server should send messages to clients with no request? Specifically, I use unity.
0
What's the proper way to set up a texture atlas in Unity 3D? I am using Unity3d (free) to make a game with user defined content (i.e., load in a map, it'll build the level for you). Everything is working as expected, except for the rendering. Note the artifact seam along the edge of the two cubes. I am not entirely sure what is causing this, other than, perhaps a rounding error? At any rate, every mesh in my scene shares the same texture, with specific UV offsets generated at 1 8 intervals for each corresponding texture Playing around with the assigned UVs moves the artifacts around. For instance, the red brick texture has the issue between the top faces So clearly, I'm doing this in a suboptimal way. Is there something specific I'm doing wrong? Or is there a better way to build meshes with texture atlases?
0
How to dynamically construct a reference to a game object by name I have game objects tagged MenuOption0, MenuOption1, MenuOption2, etc. I want to keep a currentIndex var, which gets incremented each time the user swipes on the controller. That swipe should increment the currentIndex var, and switch the reference to a new game object, whose text color will be changed. This is what I'm trying as a test GameObject testText GameObject.Find("MenuOption" 4) TextMeshProUGUI thisTextMesh testText.GetComponent lt TextMeshProUGUI gt () thisTextMesh.color colorWhite How do I dynamically construct a reference to MenuOption1,2,3,4,etc? Or is there a better way to handle this without writing a big long conditional?
0
How to retarget animation from Generic to Humanoid? I am in a constant struggle to convert a character that is indeed a humanoid character but its rig has been assigned as a generic rig. I want it to be humanoid so I can easily retarget its animation and apply them to another character of my own. The problem that I am facing is that the animations when I run from the Animation tab of Unity Editor Works just fine but when I try to play them from the Script. The animations doesn t play at all. I don t know what could be the problem. I need help in this regard. I have explored google all around and I am in a need of serious help. If someone can I ll be really very grateful. Thanks
0
custom mesh object orientation is not correct using I am making a custom mesh with the help of Traingulator script. At runtime, user can click and and generate a point then mesh creation start. Here is the way i am getting user input. void Update() RaycastHit hit Ray ray Camera.main.ScreenPointToRay(Input.mousePosition) if (Physics.Raycast(ray, out hit)) if (Input.GetMouseButtonDown(0)) GameObject sphere GameObject.CreatePrimitive(PrimitiveType.Sphere) sphere.transform.position hit.point sphere.transform.localScale new Vector3(0.2f, 0.2f, 0.2f) positions.Add(sphere.transform.position) positionsVector2.Add(new Vector2(sphere.transform.position.x, sphere.transform.position.z)) traingulatorTester.MeshMaker(positionsVector2.ToArray()) And here is the mesh maker function that calling tringulator public void MeshMaker(Vector2 vertices2D) Use the triangulator to get indices for creating triangles Triangulator tr new Triangulator(vertices2D) int indices tr.Triangulate() Create the Vector3 vertices Vector3 vertices new Vector3 vertices2D.Length for (int i 0 i lt vertices.Length i ) vertices i new Vector3(vertices2D i .x, vertices2D i .y, 0) Create the mesh Mesh msh new Mesh() msh.vertices vertices msh.triangles indices msh.RecalculateNormals() msh.RecalculateBounds() if (gameObject.GetComponent lt MeshRenderer gt () null) Set up game object with mesh gameObject.AddComponent(typeof(MeshRenderer)) filter gameObject.AddComponent(typeof(MeshFilter)) as MeshFilter filter.mesh msh Now the problem is the rotation of the custom mesh object is not correct look at this. Now I have manually set the rotation.
0
What is an acceptable receive rate for a client? I've noticed that syncing a transform( in Unity, so a Vector3, and a Quaternion ) ends up being close to 1000 byes per second received on a client( send rate of 20hz ). Multiply this by a generous 20 entities a single match might have and that's about 15k 20k bytes per second. Is this too much? What should I be aiming for? What data rates do games typically have?
0
get position of GameObject on rendertexture from camera I'm rendering the camera output to an rendertexture on a plane. This works fine. But I want to put GameObjects on the rendertexture on positions of world objects that are visible on the camera. camera.WorldToViewportPoint(obj.transform.position) shows the correct positions, but is not mapped to the rendertexture. How can I do this? So it's GameObject in world camera input plane with RenderTexture world or local position of gameobject on top of rendertexture plane.
0
Animate an element from ngui in Unity How can I animate an element from ngui in Unity? For example, how can I move it from the left to the scene when the button is clicked?
0
StateMachineBehaviour.OnStateExit is called before StateMachineBehaviour.OnStateEntered is called When I start my game I get null references in my OnStateExit of objects that are initialized in the OnStateEntered. After this it goes smooth, so it only occurs at startup before any conditions for statechanges are met. How come? My understanding is that OnStateExit is always preceded by OnStateEntered. My StateBehaviour public class DuckStateBehaviour BaseStateBehaviour override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) base.OnStateEnter(animator, stateInfo, layerIndex) mMovement.BeginDuck() public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) if (mMovement ! null) mMovement.EndDuck() base.OnStateExit(animator, stateInfo, layerIndex) public class BaseStateBehaviour StateMachineBehaviour protected Transform mTransform null protected Rigidbody2D mRigidBody null protected IMovement mMovement null public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) mTransform animator.gameObject.GetComponent lt Transform gt () mRigidBody animator.gameObject.GetComponent lt Rigidbody2D gt () mMovement animator.gameObject.GetComponent lt IMovement gt () Debug.Assert(mTransform ! null) Debug.Assert(mRigidBody ! null) Debug.Assert(mMovement ! null)
0
Usage of math.Atan2 in a 3D coordinate system with Unity I have a simple question on usage of math.Atan2 function with Unity in a 3D environment. I found this code on Unity's documentation for Math.Atan2. I changed it a bit to fit my needs. Vector3 waypoint Random.insideUnitSphere new Vector3(Random.Range(minX 1.5f, maxX 1.5f),prevPosY,Random.Range(minZ 1.5f,maxZ 1.5f)) waypoints are generated based on random unit sphere ( bounds of the plane they are on ) Vector3 relative transform.InverseTransformPoint (waypoint) float angle Mathf.Atan2 (relative.x, relative.z) Mathf.Rad2Deg I know how it works in a normal 2D coordinate system, however when switching to a 3D coordinate system, if I would want to move my character on the x z plane, then how does this actually work mathematically? I am assuming that it would be the angle between z and x axis? so in a mathematical equation would it be, angle Atan2(z x) or Atan2(x z)? Would both of them work?
0
PBR Graph option not showing up in Unity I downloaded the URP render pipeline into an existing project of mine (created using the 3D template) to try out shader graphs. All of the guides and tutorials I'm following use an option called the quot PBR Graph quot . However, I can not find that option in Unity. Did they change the name of the graph? How can I get access to it? When I open up a new project using the URP template, I have the option to choose the PBR graph, but not in my original project, so do I have to create the project with the URP template to begin with? The version I am using is 2020.2.3.
0
How can I obtain the file size of a Unity build at runtime? I'm wondering if it is possible to obtain the filesize of a game's build at runtime. Searching this topic only yields results for reducing the build size, which is not at all what I'm looking for.
0
Not sure how to deal with overlapping UI As shown above, that is the issue I am faced with, tbh I am unsure how to fix it, I have tried and its coming to a point where I am drawing blank. I am quite newbie when it comes to this. So what I have now is multiple canvas each one displaying the name of the part that it is linked to and when the part moves so does the UI with it, the problem I have is that some parts dont move and therefore creating the issue of UI clustering together, so I need to move the UI rather than the parts. What I have tried is OnTriggerEnter and adding a box collider rigidbody to the canvas and tried to move the UI when they collided but I couldnt get that to work, probably down to me. if (gameObject.tag "car") get the gameObjects name that canvas is attached to canvasName.text gameObject.name newPos mainCam.ScreenToWorldPoint(this.transform.position) set the position of the UI newPos.x transform.position.x newPos.y transform.position.y 7f newPos.z transform.position.z canvas position if ( canvas ! null) canvas.transform.position newPos That is the code that I am using to attach the UI to the part. I was hoping to try something along the lines, but then again I am clueless. if collision is detected, newPos.y newPos 2f etc... So any help would be appreciated. Apologies if that was explained bad.
0
How to directly change a vector3 I'm new to unity, and written code in general, but I haven't been able to change the value of a vector3. public Vector3 VARIABLE (5f, 5f, 5f)
0
C (Unity) Use a method common to multiple classes with the same base class The Problem I'm building one of those empire kingdom building games and so I am trying to create an efficient way of making a "ResourceManager" class handle the games resources (wood, food, iron, stone). I currently repeat a function 4 times to do the same thing. Attempt 1 I created a "Resource" class (abstract) and derived the four resources from it. In each resource there are multiple methods which are similar Example Food.CS new public static void AddResources(int amount) Player.currentFoodSupply amount foodText.text Player.currentFoodSupply.ToString() Compare to Iron.CS new public static void AddResources(int amount) Player.currentIronSupply amount ironText.text Player.currentIronSupply.ToString() The AddResource() function is static because I have other scripts (like buildings, when they get upgraded) needing to communicate with each resource. The base building class currently has a method like this public void DeductResources() Food.DeductResources(FoodCost) Wood.DeductResources(WoodCost) Iron.DeductResources(IronCost) Stone.DeductResources(StoneCost) This seems like it's so repetitive that there needs to be a more efficient way to do this. Attempt 2 A "ResourceManager" class that anything to do with the 4 resources can go through this one script. I can update that one script instead of numerous scripts that does something with the resources. Where I am undecided is this one public static void DeductResources(Resource resource, int amount) if(resource.GetType() typeof(Food)) Player.currentFoodSupply amount resource.resourceText.text Player.currentFoodSupply.ToString() else if (resource.GetType() typeof(Wood)) Player.currentWoodSupply amount resource.resourceText.text Player.currentWoodSupply.ToString() else if (resource.GetType() typeof(Iron)) Player.currentIronSupply amount resource.resourceText.text Player.currentIronSupply.ToString() else if (resource.GetType() typeof(Stone)) Player.currentStoneSupply amount resource.resourceText.text Player.currentStoneSupply.ToString() It looks like it works and I can't see a way around calling the above method 4 times as I need to know how much food or wood to add or deduct. Does anyone have any suggestions please on how to improve this code call the method once? I'm always willing to learn! Thank you
0
Use both AddForceAtPoint and change velocity property? I'm using Rigidbody2D for some game objects. It seems that when I AddForce() or AddForceAtPoint(), the game objects are mostly affected on the Y axis and hardly at all on the x axis. I don't understand why. To really get any effect on the x axis, I need to have a very strong force like 10 000. But the effect on the y axis is then extremely strong and shoots the object out of screen, yet only nudges the game object on the x scale. I believe that the problem with the y axis is because I use .velocity to move the character. But I don't know how to change the velocity directly without doing that. What should I do to use both forces and set velocity on the same object?
0
Avoiding audio transcoding in Unity? I'm working on a project where I only have access to MP3s versions of audio tracks I'd like to use. Unity is trying to be helpful and recompressing everything as Vorbis, which is not ideal due to quality loss. Even if I override the audio clip settings and set it to use MP3, Unity still transcodes the file for me, resulting in quality loss. I can set the clip to PCM, which would avoid re encoding the file into another lossy format, but the resulting file size is too large to be practical. In a perfect world I would have WAV versions of all the tracks I want to use, but that is not the case. Is there anyway to tell Unity to use the file the way it is and to leave it alone and not recompress it? For the record I am using Unity 5.3.1 and my project target is iOS.
0
In unity game appears dark exporting to ios what happened? Everything appeared darker when I exported my game to iOS. I only updated my Unity to 4.6.3 . Any idea why?
0
why is my (from example) shader appearing as black? I have the following (very simple) shader pragma kernel CSMain RWTexture2D lt float4 gt Result numthreads(8,8,1) void CSMain (uint3 id SV DispatchThreadID) Result id.xy float4(1,0,0,1) Here is the dispatcher code using UnityEngine using System.Collections public class SkyShaderDispatcher MonoBehaviour public ComputeShader shader public RenderTexture output void Start() RenderTexture output new RenderTexture(256,256,24) output.enableRandomWrite true output.Create() void Update() RunShader() void RunShader() int kernelHandle shader.FindKernel("CSMain") shader.SetTexture(kernelHandle, "Result", output) shader.Dispatch(kernelHandle, 256 8, 256 8, 1) which is the default red shader (it makes the texture red). However, when I put the texture in a material and give that to an object, then that results in the object being black. Anyone seeing what I'm doing wrong? As the shader is the default example right now it should work suggesting that maybe something is wrong with the texture? Edit Trying to fit the same code on a skybox also fails. I have changed the dispatcher code into using UnityEngine using System.Collections public class launchClouds MonoBehaviour public ComputeShader shader private RenderTexture output void Start() void Update() RunShader() void RunShader() int kernelHandle shader.FindKernel("CSMain") RenderTexture output new RenderTexture(256,256,24) output.enableRandomWrite true output.Create() Material mat gameObject.GetComponent lt Skybox gt ().material mat.SetTexture(" FrontTex",output) mat.SetTexture(" BackTex",output) mat.SetTexture(" LeftTex",output) mat.SetTexture(" RightTex",output) mat.SetTexture(" UpTex",output) mat.SetTexture(" DownTex",output) shader.SetTexture(kernelHandle, "Result", output) shader.Dispatch(kernelHandle, 256 8, 256 8, 1) but that turns the sky black rather then making the sky red. This is using unity 5 32 bits with DirectX11.
0
Importing World of Warcraft models into Unity I'm following some tutorials to create a simple game with Unity in order to learn, and I would like to enhance my learning experience by adding World of Warcraft models. Don't worry, this is all just for learning and won't see public eyes in any way. I downloaded a model viewer and I can export textures and animation from WoW with it, but when importing into Unity I'm having some problems. Which extension should I export the model to, and what is the process I should follow in order to have an object with a model I just exported? I'm really new to Unity, so any help would be great!
0
set which display on which monitor in unity I'm working on a project that has multi screen to show environment. the question is options not working when there is multi screen. for example in single screen you can set which screen shows the game but it seems there is not such option. how can I set which display or which camera get displayed on which monitor in script? for example camera display 1 to screen 2 and....? thank you for helping
0
Checkerboard using Shadergraph In Unity Shadergraph, how can I create a checkerboard pattern that works independently of the size of the quad that it is applied to? Here's what I got so far. Since I have set the Frequency to 10x6, this will work for a quad that has a scale of 20x12. However, if I increase the scale of the quad, the checkerboard will get stretched to fit. But instead, I would like it to quot add more squares quot to fit the new size. Is there a way to get it to somehow use the size of the quad instead of manually specifying the frequency?
0
Reloading scene in Unity gives weird result I am making an infinite racing game where you fly an airplane while trying to avoid obstacles. I recently finished my menu that comes up when you die. When I press the restart button that simply reloads the current scene like this SceneManager.LoadScene(1) it gives me a weird result. The obstacles starts generating at about the same position as you died previously. I never get this problem when I start the game with the Unity play button. The only thing I could think off was player prefs. It should not affect the generation of obstacles but tried anyway to use PlayerPrefs.DeleteAll() before reloading the scene, but that did not work. What could be causing this strange problem?
0
Examples about how to tie AI actions to animations? I wrote a simple test AI for a character and all that it should do is to be idle while a parameter is below threshold otherwise it should perform actions based on other parameters. So for example if X lt 0.5 gt Idle state else if A gt 0.3 gt go to point A and perform action A else if 0 lt A lt 0.3 gt go to point B and perform action B I do have the code for the AI state machine in place but now I am stuck about how to build the animator that goes with this AI. I did use the standard AI 3rd person prefab in Unity and it moves correctly, since the controller script has the logic for moving already integrated but how do I make the entry for action A and B? Do I add the animations in the blend tree of the animator, and then from the AI script I call the animator play function for a specific animation? Do I set parameters for such animations so when the variable X and A change the blend tree read them directly and transition automagically? All that I can find around is just the usual AI examples for FPS which use the same patrol chase investigate sequence but they are mostly moving or chasing not necessarily executing different animations. Any suggestion would be more than welcome
0
Facebook link gives "This game is not available for your phone" I am developing a game in Unity and have connected to FB using the plugin. I am able to login and send a request to another user with no problems. However, when I click on the notification I get the message "This game is not available for your phone". Everything is set up as it should be and both users are defined as developers for the app. The only thing is that I have not yet published the app in FB. Is that a requirement?