_id
int64 0
49
| text
stringlengths 71
4.19k
|
---|---|
0 |
How to play a video with audio using an image marker I want to play a video with audio using an image marker. In other words, user scans image marker with phone and a video with audio plays. I am finding plenty with vuforia but how can I do this with AR Foundation?
|
0 |
Importing fbx models made in Cinema4D in unity at runtime In my app I have requirement that I will be given a url and using this url I have to download a fbx model and then show it in the scene. I am able to download the model from the url using the below code. IEnumerator loadModel(string modelName) if (!isDownloaded) string targetUrl "http XXX.XXX.X.XX 3000 " modelName Debug.Log("targetUrl" targetUrl) WWW www new WWW(targetUrl) yield return www if (www.isDone) Debug.Log("downloaded " www.bytesDownloaded) var path System.IO.Path.Combine(Application.dataPath " Resources", modelName) System.IO.File.WriteAllBytes(path, www.bytes) isDownloaded true LoadAndAttachModel(imageTargetTransform, modelName) else Debug.Log(www.bytesDownloaded) And with the below code I tried using loading the model in the scene public void LoadAndAttachModel(Transform parent, String modelName) Debug.Log(modelName) var path System.IO.Path.Combine(Application.dataPath " Resources", modelName) String name modelName.Substring(0, modelName.IndexOf(".")) GameObject load Resources.Load(modelName) as GameObject Debug.Log(load.name) if (load ! null) load.transform.parent parent load.transform.localPosition Vector3.zero load.transform.localRotation Quaternion.Euler(new Vector3(90, 90, 0)) load.transform.localScale new Vector3(0.5f, 0.5f, 0.5f) else Debug.LogWarning("Can't find boneName " parent) but this code always gives exception that the gameobject load is null. I tried with the obj model and that was working fine but with fbx models this is giving exception every time. So how can I instantiate the downloaded gameobject in my scene ?
|
0 |
Can I add non trees to terrain.terrainData.treeInstances on Unity 3D? I need to create a brush in which there will be stones, poles, bushes and other elements of the environment. I bought a Prefab Brush. Whether it is possible to add the objects that I draw on the Prefab Brush scene to terrainData.treeInstances, as regular trees add? Is it possible to use a not prefab tree as an object for the TreeInstance class?
|
0 |
How do I restart tweens in DOTween and Unity? I am trying to restart a couple of tweens when I load a new scene. So far, I have this in MainMenuController.cs void Start () if (currentScene.name "MainMenuScene") Debug.Log("In current scene") tweenList 0 mainMenuText.transform.DOShakePosition(5, 10) .SetAutoKill(false).SetRecyclable(true) tweenList 1 playGameButton.transform.DOShakePosition(5, 10) .SetAutoKill(false).SetRecyclable(true) tweenList 2 exitGameButton.transform.DOShakePosition(5, 10) .SetAutoKill(false).SetRecyclable(true) DOTween.RestartAll(false) However, this does not start when I reload the scene using public void ExitToMainMenu() SceneManager.LoadScene("MainMenuScene") The above is called from another script. Is there some way to restart my tweens when the scene is loaded again?
|
0 |
How to make mobile movement using CharacterController How can i change my movement for mobile i think left and right gonna work but i don't know what should i do for jump private void Update() vector Vector3.zero if (characterController.isGrounded) verticalVelocity gravity Time.deltaTime verticalVelocity 0.5f if (Input.GetKeyDown(KeyCode.V)) verticalVelocity jump else verticalVelocity gravity Time.deltaTime vector.x Input.GetAxisRaw("Horizontal") speed if (Input.GetMouseButton(0)) if (Input.mousePosition.x gt Screen.width 2) vector.x speed else vector.x speed vector.y verticalVelocity vector.z speed characterController.Move(vector Time.deltaTime) I solved the problem this way if (characterController.isGrounded) verticalVelocity 0.5f if (Input.GetMouseButton(0)) if (Input.mousePosition.y gt Screen.height 2) verticalVelocity jump else verticalVelocity jump else verticalVelocity gravity Time.deltaTime vector.x Input.GetAxisRaw("Horizontal") speed if (Input.GetMouseButton(0)) if(Input.mousePosition.y lt Screen.height 2) if (Input.mousePosition.x gt Screen.width 2) vector.x speed else vector.x speed
|
0 |
NavMesh going in the ground I'm trying to do a navmesh. Everything seems to work fine exept that my character in almost completely under the ground. The ground is a plane with a mesh collider. I have baked it and checked my heigth mesh. My character has a rigidbody and a collider. What could be the problem ?
|
0 |
Check If a 2D Collider Is Completely Inside Outside of a Polygon Collider How can I check if one 2d collider (circle, capsule, polygon etc.) is completely inside outside of a polygon collider?
|
0 |
Unity3D multiple objects user rectangle selection I wish to allow the user to select multiple units by click and drag as most RTS do. The issue I have is that the tutorials are either in 2D or only use the transform.position such as this one. Using the transform.position will work for most cases but will not allow the user to select easily as selecting the head or feet of a unit will not work in this instance. It also means I have to do an other script using raycasts for single click selections as it is almost impossible to get the single point of the transform.position with one click. How can I do a proper rectangle selection for a 3D game? By looking at 3D RTS games I own, I noticed that they use a simplified hitbox (usually a cube or capsule).
|
0 |
InvalidOperationException in build only, when trying to select object in a dynamically loaded scene using Linq Here is the relevant code private void Awake() StartCoroutine(LoadScenes()) private IEnumerator LoadScenes() this.sceneLoad1 SceneManager.LoadSceneAsync(Scene1, LoadSceneMode.Additive) while (!this.sceneLoad.isDone) Debug.Log("Loading scene 1...") yield return null this.sceneLoad2 SceneManager.LoadSceneAsync(Scene2, LoadSceneMode.Additive) while (!this.sceneLoad.isDone) Debug.Log("Loading scene 2...") yield return null private void Start() SceneManager.GetSceneByName(Scene1) .GetRootGameObjects() .Where(root gt root.GetComponent lt God gt () ! null) .Select(root gt root.GetComponent lt God gt ()) .Single() .SpreadGospel() (Scene1 and Scene2 are const strings.) The program works fine when running in the Unity editor. However, when I make a development build, I see the follow error message InvalidOperationException Operation is not valid due to the current state of the object at System.Linq.Enumerable.Single God (IEnumerable 1 source) 0x00057 in Users builduser buildslave mono build mcs class System.Core System.Linq Enumerable.cs 1968 at MySolution.GodInitializer.SpreadGospel () 0x00001 in D repos MySolution SourceCode SourceCode GodInitializer.cs 100 at MySolution.GodInitializer.Start () 0x00012 in D repos MySolution SourceCode SourceCode GodInitializer.cs 77 ... which indicates that the scene wasn't fully loaded before I tried to access the God singleton. What changes should I make to fix the problem?
|
0 |
Intellisence doesn't show the ECS API Summaries I am not sure if this is more of an ECS topic problem or packages in general. but it would be really helpful for ECS programming with all the summaries the Unity has provided. For unity engine methods, intelligence show me descriptions and summary of classes and methods, but it doesn't work on packages I guess. I have tested this with all IDEs, AutoComplete doesn't show the description for methods and classes. However, I can go to the declaration of packages source code and see the summary. for example, Below you can see a screenshot in the Jetbrain Rider IDE, as you see when I mouse over OnCreate method it doesn't show the description.
|
0 |
Unity Default Shader Greyed Out I created a pland in Unity 3D and then tried to alter the material. I looked at it's material component, but all the options are greyed out! how do I fix this problem?
|
0 |
How to always land a square box in 90 degree How can i Always Land a box in 90 degree Here What i want Here what i don't want public Rigidbody2D boxRb public float jumpSpeed public Vector3 rotation public float rotationSpeed public bool rotationEnabled public float gravityMultiplier void FixedUpdate() if (Input.GetMouseButtonDown(0)) boxRb.velocity jumpSpeed Vector2.up if (rotationEnabled true) transform.Rotate(rotation rotationSpeed Time.deltaTime) if (Input.GetMouseButtonDown(1)) boxRb.velocity Vector2.up Physics2D.gravity.y (gravityMultiplier 1) Time.deltaTime void OnCollisionEnter2D(Collision2D collision) rotationEnabled false Debug.Log("Collided") rotationSpeed 0f boxRb.constraints RigidbodyConstraints2D.FreezePositionX transform.Rotate(0, 0, 90f) void OnCollisionStay2D(Collision2D collision) rotationEnabled false Debug.Log("In collison") rotationSpeed 0f boxRb.constraints RigidbodyConstraints2D.FreezePositionX void OnCollisionExit2D(Collision2D collision) rotationEnabled true Debug.Log("Free") rotationSpeed 10f
|
0 |
Unity Can not select Desired unity version I'm coming back to Unity after around a 4 month break and finding that opening my past unity projects creating a new project will not create it in the unity version I select(v2018.4), and rather always creates it in v2018.1, regardless of having both installed.(image attached below, file I speak specifically of is RPGprojr) If anyone has a clue to why this is happening any solution would be very much appreciated. I have tried reinstalling 2018.4 version and deleting the 2018.1 version altogether, to no avail.
|
0 |
Unity MenuItem disappears when priority is 100 Create these classes public class MyTestComponent MonoBehaviour CustomEditor(typeof(MyTestComponent)) public class MyTestComponentEditor Editor MenuItem("GameObject XXX DoTest", false, 100) private static void DoTest() Debug.Log("DoTest") save, and check if there is a new menu item in the context menu and it won't be there. Now change the priority parameter to 10 or 1 and try again it won't appear anyway. Sometimes even commenting uncommenting and reloading the editor doesn't help. Is this a bug or am I doing something wrong?
|
0 |
I'm Dragging object by using touch (mobile) it doesn't stop when hit collider I want to make object stopped when it hit collider of another object. But it doesn't stop. How can I fix this? Unity my code is public class move MonoBehaviour public float speed 0.5f Update is called once per frame void Update () if (Input.touchCount 1) Touch touch Input.GetTouch(0) float x 7.5f 15 touch.position.x Screen.width float y 2 transform.position new Vector2(x speed, y)
|
0 |
Multiple viewpoints in Unity3D? I'm working on a 3D game in Unity. The primary view is a top down view, but I am also looking to do target profiles that are true animated versions that reflect the actions of the target. The easiest way to do this, as far as I can see, is to create a second camera, a set offset from my target, facing at it. But how do I show the view from that camera in a small area of the screen? A possibly related question how to handle a mini map? I considered doing this the same way with a camera fixed high above the character that would show the area around him, but there may be a better way to do this, I'm open to any suggestions.
|
0 |
How to animate a MeshRenderer color in Unity 3D? I need to animate MeshRenderer.material.color.a, but fail. Code private void Method() AnimationClip clip new AnimationClip() AnimationClipPlayable playable AnimationClipPlayable.Create(clip) AnimationCurve alpha AnimationCurve.Linear(0, 1, 1, 0) clip.SetCurve("", typeof(MeshRenderer), "Material. Color.a", alpha) gameObject.GetComponent lt MeshRenderer gt ().material.SetColor(" Color", Color.red) Works gameObject.GetComponent lt Animator gt ().Play(playable) Doesn't work
|
0 |
Gameobject rotation around anchored pivot I'm looking for the best way to rotate the Camera(EYES) around a center of my character (Player Prototype) because if I turn around, the Camera enter inside the character. My FPS script is attached to Player Prototype, but the Camera isn't because i have to make particular rotation. So I don't know what I have to do. Have will I make the parent? If I will make it, Eyes will sum rotations to those of the parent. Or maybe I have to handle this in LateUpdate()? With RotationAround() I don't understand how to pass the second argument which is a Vector3, but I have a Quaternion.Euler. So at this point I accept all the advice or examples of what I can do to solve it.
|
0 |
Bug with OnColliderEnter Exit when colliding with multiple objects at almost the same time Unity Version 2017.4.1f1 I currently have a game with a jumping mechanic. I only want the jump to work where you're on ground, so I have planes on top of everything, which, if you are on a plane, then you can jump. This works, however if you are in a position where you are falling and then in quick succession, hit one plane, fall off that plane (like when your centre of mass is hanging off the edge), then land on another plane, at the end of it all, it still thinks you are on the air. Note I don't think this is an error with the velocity of the player, at no point do you go through a collider. So my question is, is there an error in my code (shown below) which I can fix, or should I take another approach towards jumping, thanks. Relevant code below. private bool canJump private Rigidbody rb public float jumpStrength private void OnCollisionEnter(Collision collision) if (collision.collider.CompareTag("Jumpable")) canJump true private void OnCollisionExit(Collision collision) if (collision.collider.CompareTag("Jumpable")) canJump false private void Update() if (canJump amp amp Input.GetKey(Keyode.W)) rb.velocity new Vector3(0, jumpStrength, 0) canJump false Safety measure to ensure consistent jump height Thanks
|
0 |
Any way to combine instantiated sprite renderers into one texture so I can apply into a plane at runtime? So I am procedurally generating a tile set in Unity by instantiating different tiles that only have a transform and sprite renderer components. I managed to pack the sprites using unity sprite packer assigning them a packing tag so that I reduce the draw calls drastically. But Im still having to deal with a great amount of game objects in the scene when the camera zooms out, increasing the batching and giving me problems when I try to apply light to them for example. So I am trying to find a way to combine all these sprite renderers into a texture.So I can then apply this to a plane and Ill only have to deal with one plane gameObject for the map. But I cant figure out how to do this. I cant really use the combine meshes way as they are sprites only, not meshes. I tried taking a screenshot at run time but It comes up a bit blurry. Any idea how can accomplish this? Thank you for your help.
|
0 |
Integrate Stripe with Unity I'm trying to install the Stripe API Library through NuGet Manager in Visual Studio but it installs it inside packages folder of the Project (I.E. before Project's Assets folder) doing this I cannot use the library Using UnityEngine Using Stripe Doesn't recognise this Then I Moved those installed files from packages to Assets folder Uninstalled Stripe from NuGet (as I could now access them in my script by using Stripe) Now these are the main errors that I'm getting PrecompiledAssemblyException Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included for the current platform. Only one assembly with the same name is allowed per platform. Assembly path 0 Assembly 'Assets Temp lib netstandard2.0 Stripe.net.dll' will not be loaded due to errors Unable to resolve reference 'System.Collections.Immutable'. Is the assembly missing or incompatible with the current platform? Assembly 'Assets Temp lib netstandard1.2 Stripe.net.dll' will not be loaded due to errors Unable to resolve reference 'System.Collections.Immutable'. Is the assembly missing or incompatible with the current platform?
|
0 |
Organizing objects into groups of 20. C I am building a game where players can build their own airplanes and fly them around. When the vehicle is spawned, all the buildables used to construct the airplane should be placed into groups of 20 to be merged as a submesh to the airplane. When one of the buildables is hit by a projectile and is destroyed, the mesh is reloaded, this time without the buildable that was hit creating the illusion that it was destroyed. I have a few scripts Airplane Core using System.Collections using System.Collections.Generic using UnityEngine System.Serializable public class AirplaneCore MonoBehaviour public GameObject airplaneCore public List lt AirplaneBuildable gt buildables public List lt AirplaneChunk gt chunks void Start () AirplaneChunk airplaneChunks airplaneCore.GetComponentsInChildren lt AirplaneChunk gt () foreach (AirplaneChunk chunk in airplaneChunks) chunks.Add (chunk) AirplaneBuildable using System.Collections using System.Collections.Generic using UnityEngine System.Serializable public class AirplaneBuildable public string buildableName public GameObject buildableObject public GameObject buildableNormalPrefab, buildableEditorPrefab, buildablePreviewPrefab public Vector3 pos, rot public bool destroyed false public float health 100f, maxHealth 100f And Airplane Chunk using System.Collections using System.Collections.Generic using UnityEngine System.Serializable public class AirplaneChunk MonoBehaviour public List lt AirplaneBuildable gt buildablesInChunk Anyone know a way I can take the buildables from AirplaneCore and place them in groups of 20 and assign each group to an AirplaneChunk's buildablesInChunk list? For those who don't know, the gameobjects that are in the AirplaneBuilder script are Buildable Object The actual object representing the component that was placed on the airplane. Buildable Normal Prefab The buildable that is spawned when spawning the plane. Buildable Editor Prefab The buildable that appears on the airplane in the vehicle builder editor. Buildable Preview Prefab Is simply a preview of the buildable and shows what it will look like when placed on the airplane.
|
0 |
Rotate camera around point of view I'm trying to rotate the camera around the view point of the camera. So when the user looks at a build the camera rotate around that building. But the camera does not need to have the building to rotate around. So therefore I want a camera that can rotate around his own point of view. So that the camera behave everywhere the same in the game. How can I achieve this in Unity 5.6?
|
0 |
How Do I Play An Animation In Unity 5.3.4? I am confused on how to play an animation with the new unity version because the flag "Automatically Play Animation" is gone. I cant have the animation connected to my GameObject because it plays right away. using UnityEngine using System.Collections public class FPSCamera MonoBehaviour public float lookSensitivity 5 private float xRotation private float yRotation private float currentRotationX private AnimationClip walking void Start() DONT KNOW HOW TO FIND AND START WALKING ANIMATION CLIP void Update() yRotation Input.GetAxis("Mouse X") lookSensitivity xRotation Input.GetAxis("Mouse Y") lookSensitivity xRotation Mathf.Clamp(xRotation, 90, 90) transform.rotation Quaternion.Euler(xRotation, yRotation, 0)
|
0 |
WebGL .NETCoreApp 1.1 UnityLoader.js SyntaxError expected expression, got end of script After creating a release build of my game using Unity 5.6, I could navigate to the created folder and open the 'index.html' file and my game would load and play normally. However, when trying to integrate it into my WebApp (.NETCore 1.1), I would continually get this error in Chrome, Firefox, IE, etc.. UnityLoader.js SyntaxError expected expression, got end of script Invoking error handler due to TypeError UnityLoader r is not a function
|
0 |
Always operate at Time.timeScale 1? How do I make a specific script always operate at Time.timeScale 1 no matter what? I want it to override even when another script calls Time.timeScale 0 for example.
|
0 |
Build and Run results in an empty window Out of nowhere my builds are broken. The .exe just always gives me this little blank window but it runs fine in the editor. Here are some things I have tried Deleted the previous build files Deleted the Library folder Upgraded to 2020.2.4f1 Uninstalled Reinstalled Unity Deleted AppData Files Deleted branch and pulled it back down (the branch works fine for other people) Here are my resolution and presentation settings
|
0 |
How to store the co ordinates traced by a character in unity C script? I have a navmesh agent with a trail renderer component attached to it, who travels to a pre determined destination based upon user input using unity's built in Navigation system. I want to store the (x,y,z) cordinated of the path traced by the character in some kind of data structure and then I want the camera to trace that exact path, but at some height above so the path(trail renderer) is visible.
|
0 |
Find points inside a closed area I have a 2D rectangular grid (100x100) with 3 types of cell (Empty, Base and Outline). I need to find cells inside the territory formed by Base and Outline cells. For example, in this scheme I need to find the yellow cells. The same algorithm, but with hexagonal grid, was implemented in the game in this YouTube video https youtu.be 6zyMHnBM5x8. Any help on how to achieve that would be very helpful. Thanks.
|
0 |
Chroma depth shader unity I'm trying to reproduce a post effect with unity seen in the answer here. Chromadepth answer For the moment I just manage to reproduce the wave effect with a quick edge detection. I tried multiple textures but can't find one that fit do the same effect. I am using this texture The result for far. Shader "Unlit ChromaDepthEdge" Properties MainTex ("Texture", 2D) "white" Ramp ("Texture", 2D) "white" Threshold("Threshold", Float) 0.1 SubShader Pass ZTest Always Cull Off ZWrite Off CGPROGRAM pragma vertex vert pragma fragment frag pragma target 3.0 include "UnityCG.cginc" struct appdata float4 vertex POSITION sampler2D MainTex sampler2D Ramp Request camera depth buffer as a texture. Incurs extra cost in forward rendering, "just there" in deferred. sampler2D CameraDepthTexture float4 MainTex TexelSize float4x4 InverseViewMatrix float Threshold void vert ( float4 vertex POSITION, out float4 outpos SV POSITION) outpos UnityObjectToClipPos(vertex) fixed4 frag (UNITY VPOS TYPE screenPos VPOS) SV Target Convert pixel coordinates into screen UVs. float2 uv screenPos.xy ( ScreenParams.zw 1.0f) uv.y (uv.y 1) 1 Depending on setup platform, you may need to invert uv.y Sample depth buffer, linearized into the 0...1 range. float depth Linear01Depth( UNITY SAMPLE DEPTH(tex2D( CameraDepthTexture, uv))) float2 uvDist 3 MainTex TexelSize.xy float depthUp Linear01Depth(UNITY SAMPLE DEPTH(tex2D( CameraDepthTexture, uv uvDist float2(0, 1)))) float depthDown Linear01Depth(UNITY SAMPLE DEPTH(tex2D( CameraDepthTexture, uv uvDist float2(0, 1)))) float depthLeft Linear01Depth(UNITY SAMPLE DEPTH(tex2D( CameraDepthTexture, uv uvDist float2( 1, 0)))) float depthRight Linear01Depth(UNITY SAMPLE DEPTH(tex2D( CameraDepthTexture, uv uvDist float2(1, 0)))) float mean ((depthUp depth) (depthDown depth) (depthLeft depth) (depthRight depth)) 4 Compressing the range, so we get more colour variation close to the camera. depth saturate(2.0f depth) depth 1.0f depth depth depth depth 1.0f depth return depth Use depth value as a lookup into a colour ramp texture of your choosing. fixed4 colour tex2D( Ramp, depth 6 Time.y 4) return lerp(colour, colour 6, mean gt Threshold) ENDCG What did I miss ? Thanks in advance.
|
0 |
How can teams collaborate on Unity 3D projects? With a friend of mine, we are planning to develop a small game to get the hang of game development and teamwork. But since Unity 3D barely supports version control (or at least the free version lacks of it) we have no idea how to efficiently manage teamwork. Sharing tasks in a small project is also seems like a challange for us. I would also appreciate any advice that could be useful for beginner indie developers related to teamwork. )
|
0 |
Unexpected scaling of UI elements after build Unity Web I have an unusual scaling of UI Elements after my build in unity for WebGL Game in Unity Engine Game in Itch.io Has anyone seen this kind of behaviour? any suggestions on what I should look into? Happy to provide more info on the matter. Thanks!
|
0 |
Unity Instantiate GameObject from client on Network I am building a game where a weapon shoots prefab bullets. I am trying to make this a multiplayer game, so the bullets need to be spawned into the Network. What happens right now is that if I shoot a bullet from a host, the bullet is shot, but doesn't appear on the client screen. If I shoot the bullet from the client, the bullet doesn't appear on either screen. In fact, the function CmdShoot() isn't even called, as the Debug.Log("Hello") is not called. Here is the current code public class Gun MonoBehaviour private GameObject bulletPrefab void Update() if (Input.GetMouseButtonDown(0)) owner.GetComponent lt PlayerSetup gt ().CmdShoot(bulletPrefab, transform.position, owner.name, GetComponentInParent lt Weapon gt ().angle) public class PlayerSetup NetworkBehaviour void Start () Disable components if not local player Command public void CmdShoot(GameObject bulletPrefab, Vector3 position, string playerName, float angle) Debug.Log("Hello") GameObject bullet Instantiate(bulletPrefab, position, Quaternion.identity) bullet.name "bullet " playerName bullet.GetComponent lt Rigidbody gt ().AddForce(Quaternion.AngleAxis(angle, Vector3.forward) Vector3.right bulletPrefab.GetComponent lt Bullet gt ().force) Destroy(bullet, 10f) NetworkServer.Spawn(bullet) Edit This piece of code doesn't work either, gives the same result. No error, but the function is also not called. The Input is detected though void Update() if (Input.GetMouseButtonDown(0)) CmdShoot() Command void CmdShoot() Debug.Log("Shoot") GameObject bullet Instantiate(gunComponent.bulletPrefab, gun.position, Quaternion.identity) bullet.name "bullet " transform.name bullet.GetComponent lt Rigidbody gt ().AddForce(Quaternion.AngleAxis(GetComponentInChildren lt Weapon gt ().angle, Vector3.forward) Vector3.right gunComponent.bulletPrefab.GetComponent lt Bullet gt ().force) Destroy(bullet, 10f) NetworkServer.Spawn(bullet)
|
0 |
Is there a way to display navmesh agent path in Unity? I'm currently making a prototype for a game I plan to develop. As far as I did, I managed to set up the navigation mesh and my navmeshagents. I would like to display the path they are following when setDestination() is fired. I did some researches but didn't find anything about it. EDIT 1 So I instantiate an empty object with a LineRenderer and I have a line bewteen my agent and the destination. Still I've not all the points when the path has to avoid an obstacle. Furthermore, I wonder if the agent.path does reflect the real path that the agent take as I noticed that it actually follow a "smoothier" path. Here is the code so far GameObject container new GameObject() container.transform.parent agent.gameObject.transform LineRenderer ligne container.AddComponent lt LineRenderer gt () ligne.SetColors(Color.white,Color.white) ligne.SetWidth(0.1f,0.1f) Get def material ligne.gameObject.renderer.material.color Color.white ligne.gameObject.renderer.material.shader Shader.Find("Sprites Default") ligne.gameObject.AddComponent lt LineScript gt () ligne.SetVertexCount(agent.path.corners.Length 1) int i 0 foreach(Vector3 v in p.corners) ligne.SetPosition(i,v) Debug.Log("position agent" g.transform.position) Debug.Log("position corner " v) i ligne.SetPosition(p.corners.Length,agent.destination) ligne.gameObject.tag "ligne" So How can I get the real coordinates my agent is going to walk throught ?
|
0 |
Screen Space Camera improper scaling on iOS device only I've reproduced the issue in a simple setup where I have two canvas's, one overlay and one camera. I put an image under both set to maintain aspect ratio, and set them to use anchors for sizing instead of pixels. On iOS the camera space canvas stretches the image improperly, and the overlay is fine. Both have identical settings, with Canvas Scaler set to screen size and to match width. This only seems to happen on older iOS devices, but my sample size is too small to say that for certain. I expect both images to maintain aspect ratio on device, but the image under Screen Space Camera stretches out of aspect ratio. Local Scale on all objects is what I would expect it to be so nothing interesting there. Has anybody run into this issue before or have any idea what might be causing it?
|
0 |
Why when drawing a circle using linerenderer the circle is not complete? using UnityEngine using System.Collections using System.Collections.Generic using System.Linq RequireComponent(typeof(LineRenderer)) public class DrawCircle MonoBehaviour Range(0, 50) public int segments 50 Range(0, 50) public float xradius 5 Range(0, 50) public float yradius 5 LineRenderer line void Start() line gameObject.GetComponent lt LineRenderer gt () line.positionCount (segments 1) line.useWorldSpace false private void Update() CreatePoints() void CreatePoints() float x float y float z float angle 20f for (int i 0 i lt (segments 1) i ) x Mathf.Sin(Mathf.Deg2Rad angle) xradius z Mathf.Cos(Mathf.Deg2Rad angle) yradius line.SetPosition(i, new Vector3(x, 0, z)) angle (360f segments) In the screenshot in the left of the circle there is a gap the circle is not perfect completed.
|
0 |
3D infinite platform generation Can't increase space between platforms. (Unity) As seen in the images, changing the value of 'spawnZ' affects the distance between the initial platform and the first generated platform but afterwards it has no affect whatsoever. public GameObject tilePrefabs public float spawnZ 10f public float tilelength public int amnTilesOnScreen 5 public Transform playerTransform Use this for initialization void Start () for (int i 0 i lt amnTilesOnScreen i ) SpawnTile() Update is called once per frame void Update () if(playerTransform.position.z gt (spawnZ amnTilesOnScreen tilelength)) SpawnTile() private void SpawnTile(int prefabIndex 1) GameObject go go Instantiate(tilePrefabs 0 ) as GameObject go.transform.SetParent(transform) go.transform.position Vector3.forward spawnZ spawnZ tilelength
|
0 |
Help with OnTriggerEntered Canvas UI This seems like it should be incredibly easy and I know there are other posts out there with a similar title, but I promise you I have looked at all of them. All I want is for my canvas that simply says "you win" to appear when I enter an invisible box collider that I have . My canvas is by default set to disabled. public class YouWin MonoBehaviour public Canvas myCanvas private void Start() myCanvas GetComponent lt Canvas gt () void OnTriggerEnter (Collision Collider) myCanvas.gameObject.SetActive(true) This script seems incredibly simple and straightforward, but for whatever reason, when I enter my box, nothing at all happens. Why might this be? What am I missing? As per an answer I also tried public class YouWin MonoBehaviour public GameObject canvas void OnTriggerEnter (Collider Collider) canvas.gameObject.SetActive(true) But had no luck with this either. I've been tinkering to no avail, can you please give me some suggestions?
|
0 |
Client not executing commands in Unet Edit Okay, so I partially solved the problem by adding a rigid body component to the capsule. I read somewhere that apparently you have to have one in order to move on the server. Problem 2 The next problem I have is that I can now move a capsule that is spawned by the client fine and the host can move it as well as many times as they like. The problem I am getting now is that when the host spawns a capsule the client cannot move it at all and I get a sort of glitch effect on the client side and the capsule still doesn't move on the host side. Is there a reason why it would only work one way and not the other way around? I thought at first it might have to do with Spawn vs SpawnWithClientAuthority but that doesn't seem to make a difference. Project Summary I have a pretty simple multiplayer project, all I want to do is have one player host and the other join as a client. Once they are joined together the two players can spawn a capsule and then when the user clicks on a capsule. They should be able to pick it up and move it around the scene and the other player should be able to see this action. I can get both players to connect to the server and spawn their own capsule and both players can see this. The movement script is done as well. However, it is only transmitted on the host side. When the client picks up the object it does not update on the server. Problem I have done a bit of debugging and have found that when I call the command on the client it is not being executed at all through line breaks and simple debug statements. Code public void OnInputClicked(InputClickedEventData eventData) Debug.Log("clicked") if (isLocalPlayer) if (Physics.Raycast(transform.position, direction transform.forward, hitInfo out hit, maxDistance range)) Debug.Log("Hit capsule") objectID GameObject.Find(hit.transform.name) objNetId objectID.GetComponent lt NetworkIdentity gt () playerIDThatClicked player.GetComponent lt NetworkIdentity gt () CmdAssignAuthority(objNetId, playerIDThatClicked) Debug.Log("grabbed") else if we are releasing the object we want to unassign our authority if (objNetId ! null) CmdAssignAuthority(objNetId, playerIDThatClicked) objNetId null Debug.Log("released") Command void CmdAssignAuthority(NetworkIdentity target, NetworkIdentity player) Debug.Log("inside cmd") current target.clientAuthorityOwner playerconn player.connectionToClient if (current ! null amp amp current ! playerconn) Debug.Log("Had authority now removing and replacing") target.RemoveClientAuthority(current) target.AssignClientAuthority(playerconn) else if (current ! null) Debug.Log("removing authority") target.RemoveClientAuthority(current) else if (current null) Debug.Log("No authority, adding one now") target.AssignClientAuthority(playerconn) else Debug.Log("CmdAuthority error") target.RemoveClientAuthority(playerconn) Question Am I calling this command correctly? The script is attached to a player prefab and the capsule prefab contains a network id and a network transform. I am pretty new to Unet and this feels like a noob mistake.
|
0 |
Google Play exclude devices I have a game that I'm developing in Unity. The game will be released for Android, so I'm working with the Google Play Console. The thing here is that I don't know how to block (Made not available) some devices with certain properties. For example, I need to made my game NOT available for tablets and for devices that don't have at least 1 GB of RAM. Does anyone know how can I do this?
|
0 |
Separating scene generation and scene starting in Unity? I'm working on a game, where the map is generated, and The map is generated in an Awake(), so when an object's Start() is called, the map should be fully initialized. But the scene's physics world won't be updated till the next FixedUpdate. So when Start() is called, there is a high chance, that physics operations are done in an incorrect world (like raycasting) I tried using Physics.SyncTransforms, but it didn't solve the issue for some reason. (Why?) My next approach was to start the objects with a delay. Precisely after a FixedUpdate. So I started a Coroutine in the Start() method, which waits for a FixedUpdate, then starts the object. But this caused that for example ObjectA's Update() is called before ObjectB's Start coroutine finishes. How could I achieve that scenes won't be started until the scene is fully initialized? Is there a way to tell Unity to call every Start() i.e. 1 frame later? Or how else could I fix this? What is the best solution?
|
0 |
How should a Unity object control it's state? I've been using Unity's component based design, and the biggest problem I've faced is how to control an object's( not component's ) state. The problem is, some components must act differently based on the object's state. However, checking an object's state within a non specific component( imagine we have a "DamageEnemyComponent" ) won't work at all because it makes assumptions about the object it's attached to. The alternative is to make each component perform one, and only one function. The components are then disabled enabled or added removed depending on the object's state( probably managed by a more specific component. ) Imagine we have a "Boomerang" object. Assume it has only two states idle( being held by the player ) and firing. In the idle state, the boomerang would have very few components, because we don't want it to interact with the world while it's simply being held. It may have components to listen for a "throw", though. Once it is thrown, some state manager on the object needs to update the object to have components for moving, damaging enemies, maybe picking up items etc. When the boomerang is back in the hands of the player, it's component list would need to be restored. This would work, but it would basically be building a new game object for each state, which is incredibly tedious and messy without Unity's editor. Not to mention the inheritance and interfaces can't be used well here( since the state specific components will be built into the state manager script. ) I can't see a way to control state using Unity's components. How is this usually done? It feels as if Unity should provide a way to build different states in the editor, much like building an object.
|
0 |
Double jump, without allowing two jumps after falling down a cliff I created a script that allows the player to double jump, which works like a charm. The problem is if the player walks off a cliff, they will still be able to jump twice. But that isn't how double jump works, right? Can someone tell me how to make it so that if the player falls down a cliff, they will be able to jump only once? using System.Collections using System.Collections.Generic using UnityEngine public class PlayerController MonoBehaviour private Rigidbody2D rb private Animator anim private float movementInputDirection public float movementSpeed 10f public float jumpForce 16f public int amountOfJumps 1 private int amountOfJumpsLeft private bool isFacingRight true private bool isWalking private bool isGrounded private bool canJump public float groundCheckRadius public LayerMask whatIsGround public Transform groundCheck void Awake() rb GetComponent lt Rigidbody2D gt () anim GetComponent lt Animator gt () void Start() amountOfJumpsLeft amountOfJumps void Update() CheckInput() CheckMovementDirection() UpdateAnimations() CheckIfCanJump() private void FixedUpdate() ApplyMovement() CheckSurroundings() private void CheckMovementDirection() flips sprite if (isFacingRight amp amp movementInputDirection lt 0) Flip() else if (!isFacingRight amp amp movementInputDirection gt 0) Flip() if(rb.velocity.x ! 0) isWalking true else isWalking false private void UpdateAnimations() anim.SetBool("IsWalking", isWalking) private void CheckInput() movementInputDirection Input.GetAxisRaw("Horizontal") if (Input.GetButtonDown("Jump")) Jump() private void ApplyMovement() player movement rb.velocity new Vector2(movementSpeed movementInputDirection, rb.velocity.y) private void Flip() isFacingRight !isFacingRight transform.Rotate(0f, 180f, 0f) private void Jump() if (canJump) rb.velocity new Vector2(rb.velocity.x, jumpForce) amountOfJumpsLeft private void CheckSurroundings() isGrounded Physics2D.OverlapCircle(groundCheck.position, groundCheckRadius, whatIsGround) private void CheckIfCanJump() if (isGrounded amp amp rb.velocity.y lt 0.01) amountOfJumpsLeft amountOfJumps if (amountOfJumpsLeft lt 0) canJump false else canJump true private void OnDrawGizmos() Gizmos.DrawWireSphere(groundCheck.position, groundCheckRadius)
|
0 |
How to play GameObject (ParticleSystem) and stop? Have a game where you've to shoot somethings and when you hit the GameObject I've should play. I've tried with Instantiate but I can keep shooting even if the gameobject is destroyed. What should I do in order to fix it? public GameObject particlesystem void Start () particlesystem GameObject.Find("Effect") void Hit() Destroy(gameobject) Instantiate(particlesystem, transform.position, transform.rotation) This is how I handle it now, but as I wrote earlier I can keep activating the particle system.
|
0 |
How can I improve the current enemy spawning system for my strategy game I'm currently making an RTS game for mobile where mini battles would take place on tiny battlegrounds. The problem is that currently the player is spawning its units based on a currency system, whereas the enemy is spawning based on a timed system. The timed system would make sense in a tower defense game, but not here. Here is a short clip of it in action https twitter.com LewanayG status 1378009426808950794 This is my current spawn script void Start() start spawning waves StartCoroutine(SpawnWaves()) IEnumerator SpawnWaves() before spawning the first enemies, wait a moment yield return new WaitForSeconds(startWait) while (true) if not all characters of this wave are spawned, spawn new enemy and that wait some time before spawning next enemy in this wave for (int i 0 i lt startEnemyCount i ) int random Random.Range(0, enemies.Length) GameObject newEnemy Instantiate(enemies random , transform.position, transform.rotation) as GameObject newEnemy.transform.parent enemyParent.transform yield return new WaitForSeconds(spawnWait) to add some randomness between spawns make sure the next wave contains more enemies than this one startEnemyCount extraEnemiesPerWave wait before starting the next wave yield return new WaitForSeconds(waveWait) Under the current system, as long as the player has more units on the battleground than the current spawn rate of the enemy it will win, and its really difficult to balance this game based on the two spawn systems. How do you suggest I handle this problem and the spawn system of enemy units?
|
0 |
How can you detect object s using raycast from mouse cursor? using System.Collections using System.Collections.Generic using UnityEngine public class CameraRaycast MonoBehaviour public Camera cam void Start() void Update() Ray ray cam.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0)) RaycastHit hit if (Physics.Raycast(ray, out hit, 1000)) if (hit.transform.tag "Interactable") print("I'm looking at " hit.transform.name) else print("I'm looking at nothing!") This is working fine but this send raycast hit from the camera. I want to send the raycast from the mouse cursor so if the mouse cursor is moving over object it will detect it. Just instead the camera the mouse cursor.
|
0 |
Center attribute of BoxCollider2D not working? I've been trying to make a laser beam for my 2D shmup. I've set up a LineRenderer, along with a box collider 2D, and I've noticed that the center of the collider is positioned at one end of the line. My settings are Line 2 Elements (1)0x 0y 0z (2)0x 0y 10z Not using World Space Rotated 90 on the Z axis (to face the 2D camera) I thought the Center attribute would align the box collider, but changing the X value seems to do nothing. Is it possible to align the box collider such that it is around the beam, and not sticking outside of it? Image reference
|
0 |
Should I do interactions between a new class and the main engine via a redirector class, or directly refer to only the classes the new class needs? I'm making an open source voxel engine, and there's an architectural problem that I would like an answer to. I have come up with 2 different solutions, and would like your opinions on When I'm creating a new class for a feature that uses the voxel engine, should the new class only refer to a big re director class called VoxelWorld that redirects the calls to whatever component is responsible for it (solution 1), OR should the new class directly refer to only the classes it actually needs. Simply put, should the new class refer to the entire voxel engine, or just the parts it needs to? This may be similar to a monolithic vs microservice problem? Solution 1 All interactions go through a single entry point (I shall call it the VoxelWorld class). It's a single class, which would redirect all calls to whichever component is responsible for it. Examples of those calls would be for example VoxelWorld.GetVoxelData(position) or VoxelWorld.UnloadChunk(position). These calls would be coming from wherever, maybe a custom class made by the user such as a TerrainDeformer. The TerrainDeformer would only have a reference to VoxelWorld, and nothing else (except for all the parameters it needs to deform the terrain, such as the deformation range). The TerrainDeformer would simply call VoxelWorld.EditTerrain(listOfModifications), and that's it. The VoxelWorld would be responsible for redirecting the EditTerrain call to whichever class is responsible for editing the terrain, for example, a VoxelWorldEditor. The VoxelWorld.UnloadChunk call would be redirected to ChunkManager, which is responsible for managing chunks. Here's a picture to better explain it The public VoxelWorld would be the only public class in assembly A. Everything else is internal, meaning they are only visible for other classes inside assembly A. The assembly A is also like a black box, it is mostly (except for the VoxelWorld) hidden from the outside project. It just works, that's not a good ideology, but sometimes a necessary one. Everything in assembly B is easily extensible and public to the user. It contains the code the user would be messing with. VoxelWorld would essentially by only a redirector of calls. It would have absolutely no logic, only redirections. A function in VoxelWorld.cs could look like this public void LoadChunk(int x, int y, int z) ChunkManager.LoadChunk(x, y, z) Solution 2 Everything that the user wants to add refers to only the classes it really needs. Now, forget all that public internal redirecting stuff from solution 1, but keep in mind the different classes. This is kind of like the interface segregation principle, but just without the interface part. The interface segregation principle (ISP) states that no client e.g. TerrainDeformer should be forced to depend on methods it does not use e.g. LoadChunk In solution 1, everything depends on everything. That's the blessing and the curse of solution 1. In solution 2, that's not a problem because a class only depends on what it actually needs. Solution 2 is more traditional and maybe cleaner gt easier to maintain. I feel like I like solution 2 more than solution 1, but both seem good. Here's the main benefits and disadvantages Solution 1 Easy to use API (VoxelWorld.DoWhatever()) It contains a black box, so it's harder for the user to extend the very core features. (Of course, it wouldn't be an actual black box, this is open source, it's just something that the user shouldn't mess with) Solution 2 Easier to maintain and extend More difficult API, everything is scattered so the user has to explicitly know if some feature already exists (in solution 2, the user can just scroll through the suggested functions for VoxelWorld. ()) So, which solution do you recommend, and why? Or is there some third solution that I haven't thought about? This was quite a long question, but I hope it can help others who might have the same problem. I tried googling but didn't find anything related to this kind of problem, but I didn't really even know what to search for.
|
0 |
Why is my canvas being rendered underneath everything? I'm currently trying to implement a UI that will overlay a scene and follow a scene's main camera, but I'm running into some issues. When I set canvas's mode to Screen Space Camera, the Z position of the canvas is always set to 89.5, which is behind all of the objects that are generated into my scene, making the canvas and the UI elements on it completely invisible to the player. This is the game preview before running the game, with the UI elements clearly visible This is the game while it's running in the editor, with the UI elements not visible at all This is what my hierarchy looks like This is what the properties for the canvas look like Why is my UI not visible when I run my game? How can I fix this?
|
0 |
How do you de serialize a monobehaviour class? It seems JsonUtility.FromJson does not work for MonoBehaviour classes (and I can't get Newtonsoft to parse strings to Vector3s) Suppose you have a MonoBehaviour class like this (so that the values can be easily specified in inspector in editor) public class PropertyClass MonoBehaviour public Vector3 location public string name Suppose you have json data downloaded as a string called text, that you try to convert to PropertyClass format via using an JSONHelper around JSONUtility.FromJson(text) How do you have it autopopulate? If you specify a FromJsonOverwrite solution how do you have that work with JSONHelper? using System using UnityEngine using System.Collections public static class JSONHelper public static T FromJson lt T gt (string json) Wrapper lt T gt wrapper UnityEngine.JsonUtility.FromJson lt Wrapper lt T gt gt (json) return wrapper.Items public static string ToJson lt T gt (T array) Wrapper lt T gt wrapper new Wrapper lt T gt () wrapper.Items array return UnityEngine.JsonUtility.ToJson(wrapper) Serializable private class Wrapper lt T gt public T Items
|
0 |
Paint with soft brush (logic) During the last few days I was coding a painting behavior for a game am working on, and am currently in a very advanced phase, I can say that I have 90 of the work done and working perfectly, now what I need to do is being able to draw with a "soft brush" cause for now it's like am painting with "pixel style" and that was totally expected because that's what I wrote. My current goal consist of using this solution Import a brush texture Create an array that contain all The alpha values of that texture When drawing use the array elements in order to define the new pixels alpha And this is my code to do that (it's not very long, there is too much comments) The main painting method theObject the object to be painted tmpTexture the object current texture targetTexture the new texture void paint (GameObject theObject, Texture2D tmpTexture, Texture2D targetTexture) x and y are 2 floats from another class they store the coordinates of the pixel that get hit by the RayCast int x (int)(coordinates.pixelPos.x) int y (int)(coordinates.pixelPos.y) iterate through a block of pixels that goes fro Y and X and go brushHeight Pixels up and brushWeight Pixels right for (int tmpY y tmpY lt y brushHeight tmpY ) for (int tmpX x tmpX lt x brushWidth tmpX ) check if the current pixel is different from the target pixel if (tmpTexture.GetPixel (tmpX, tmpY) ! targetTexture.GetPixel (tmpX, tmpY)) create a temporary color from the target pixel at the given coordinates Color tmpCol targetTexture.GetPixel (tmpX, tmpY) change the alpha of that pixel based on the brush alpha myBrushAlpha is a 2 Dimensional array that contain the different Alpha values of the brush the substractions are to keep the index in range if (myBrushAlpha tmpY y, tmpX x .a gt 0) tmpCol.a myBrushAlpha tmpY y, tmpX x .a set the new pixel to the current texture tmpTexture.SetPixel (tmpX, tmpY, tmpCol) Apply tmpTexture.Apply () change the object main texture theObject.renderer.material.mainTexture tmpTexture Now the fun (and bad) part is the code did exactly what I asked for, but by asking to draw anytime with the brush alpha I found myself create a very weird effect which is decreasing the alpha value of an "old" pixel, so I tried to fix that by adding an if statement that check if the current alpha of the pixel is less than the equivalent brush alpha pixel, if it is, then augment the alpha to be equal to the brush, and if the pixel alpha is bigger, then keep adding the brush alpha value to it in order to have that "soft brushing" effect, and in code it become this if (myBrushAlpha tmpY y, tmpX x .a gt tmpCol.a) tmpCol.a myBrushAlpha tmpY y, tmpX x .a else tmpCol.a myBrushAlpha tmpY y, tmpX x .a But after I've done that, I got the "pixelized brush" effect back, am not sure but I think maybe it's because I'm making these conditions inside a for loop so everything is executed before the end of the current frame so I don't see the effect, could it be that? Am really lost here and hope that you can put me in the right direction.
|
0 |
Head tracking stuttering lag blur issue with Google Carboard I am working on Virtual Reality app. I have created a city terrain and when I move around the terrain using keyboard it move smoothly but when using head tracking I feel a lag blur when I move or look around the scene using Google Cardboard. How can I improve the performance.Is there any method in unity?
|
0 |
How to get good movement synchronization in a networked game (action shooter) I've spent the last two days trying to get good movement interpolation with Photon in Unity but I can't get anything that I'm happy with. I've tried several methods but none satisfied me. My understanding is that I better use some kind of interpolation (as opposed to extrapolation dead reckoning) because in my game the players can change direction fast. I've tried lerping between the current position and the last received authorized position, I've tried lerping between the old and the new authorized position, but nothing gives me the right amount of responsiveness smoothness. What can I do? Sample code public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) if (stream.IsWriting) do we have authority over this object? stream.SendNext(transform.position) stream.SendNext(transform.rotation) else newNetworkTime Time.time oldPosition transform.position oldNetworkPosition networkPosition networkPosition (Vector3)stream.ReceiveNext() networkRotation (Quaternion)stream.ReceiveNext() void RemoteMovement() float t 1.0f ((newNetworkTime interpolationPeriod Time.time) interpolationPeriod) transform.position Vector3.Lerp(oldPosition, networkPosition, t) transform.rotation Quaternion.Lerp(transform.rotation, networkRotation, Time.deltaTime movementSpeed)
|
0 |
Unity, Which side of Collider2D was hit by raycast? I've got a player firing out 2d raycasts. If one of them hits a boxcollider2d I would like to know if it hit the top side, bottom side, left side, or right side. How would I go about doing this? I've tried using Bounds but that didn't work out very well.
|
0 |
2d ParticleSystem batching problem I have multiple ParticleSystems with TextureSheetAnimation pointing to the same texture, using different offsets rows to choose different textures. They seem to batch with each other, but they're also being split by Unity into multiple batches in a strange manner. Here's a Frame Debugger view These 4 Draw Dynamic are on the same atlas, using Mobile ParticlesAdditive shader. The reason of breaking batching is Objects have different batching keys. This is usually caused by using different vertex streams on ParticleSystems or by mixing Lines and Trails, or by mixing lit and unlit geometry. All of the ParticleSystems have a simple setup, some Color Over Lifetime, some Velocity Over Lifetime etc. The strange thing is that Unity breaks batching like it makes one batch, puts half of the stars and half of the smokes into that, and then, makes another batch from these two. So they do batch, and the don't o.O I couldn't find and help on the web about this issue. I'd be glad for help.
|
0 |
IronPython with Python in Unity How should I manage dependencies Python side? I am currently trying to get Python working in Unity, and I was wondering how would I manage dependencies on the Python end. For example, say I have a Python script with the following dependencies import tensorflow as tf import numpy as np import cv2 I would like to get these working in IronPython in Unity. Does IronPython have it's own package manager like pip for this, and if so, how would I go about integrating this in Unity? Is there other .dlls for specific packages? Thanks in advance.
|
0 |
What is the Unity 2019.3.5 version of UnityEngine.UI.Text ? I was following a tutorial on how to create a dialogue Box in Unity, and in one part of the tutorial the tutor imports UnityEngine.UI and creates an object of type Text, but my version of Unity is 2019.3.5f1 and I learned through searching a bit online that this UnityEngine.UI doesn't exist anymore in this version, and that it was replaced with UnityEngine.UIElements, and this Text type doesn't exist anymore as well. I couldn't find a replacement for Text or what is the new nomenclature, nothing from trying stuff that popped in the auto complete or searching for answers in the Internet gave me answers. Maybe I just searched poorly, but if anyone happens to know, could you kindly answer?
|
0 |
How to make Frame Independent Timer Clock I want to make a frame Independent Timer that it work consistently across different computer configuration.
|
0 |
Multi level 3D grid based pathfinding in Unity I'm trying to come up with a way to pathfind on multiple levels. See image The orange walls would be considered a ladder, connecting you to the upper levels. At first I thought of looking at it as though it were top down 2d, but I also need to be able to go under things at some point. How can I compute these paths?
|
0 |
Why Does unity LightPosition 0 Seem to Depend on Camera Position? I'm trying to write a fairly basic shader but I keep running into lighting issues with Unity. My first problem was trying to figure out which variable stored the light's position in world space. (I'm only working with one light, at least at the moment). I finally found something that responds to movement of my light source unity LightPosition 0 . However the shader still didn't do what I wanted it to do, so I did some debugging I have a basic vertex and fragment shader and what I'm currently doing in the fragment shader is float4 c float4(0, 0, 0, 1) float3 lp normalize(unity LightPosition 0 ) c.rgb lp return c This should just set the color of my object to the normalized position of the light source, correct? What I see in my scene is my object changes colors when I move my camera around it (I'm not moving the light source at all, it is a separate entity). The color also seems to increase in strength as I zoom in. To me, it seems as if unity LightPosition 0 is related to my camera's position, as well as orientation and zoom level, yet the documentation I've found says it should represent the position of the light in world space. I tried switching to using the following float3 lp float4( unity 4LightPosX0 0 , unity 4LightPosY0 0 , unity 4LightPosZ0 0 , 1.0 ) ...but that only colors my object red regardless of the light's actual position. Additionally, I've set the LightMode tag to Vertex. It seems like simply getting the world position of the light source shouldn't be this difficult. What am I not doing correctly? EDIT I've been playing around with the camera and light position and I think that unity LightPosition 0 actually puts out position in the projection space. If I place the light source in the lower left corner of the screen, the object is black. Upper left the object is green (0, 1), upper right is orange (1, 1), and lower right is red (1, 0). When I place it in the lower left (0, 0) and move the camera in front of it, it becomes blue. This is consistent with the depth value behavior. (0, 0, 0) would appear as blue. Now, how to get it from projection back to world?...or should I use a different variable?
|
0 |
How do I rotate the Camera around the player by Keypress in Unity? I want to rotate the camera around the player by pressing E and Q but it doesnt rotates around the player. I tried RotateAround but didnt worked. Code public Transform player public float smoothSpeed 0.125f public float rotateSpeed public Vector3 offset private Vector3 velocity Vector3.zero void LateUpdate () transform.position Vector3.SmoothDamp(transform.position, player.position offset, ref velocity, smoothSpeed Time.deltaTime) void Update() if(Input.GetKey (KeyCode.E)) transform.RotateAround(player.position, Vector3.up, rotateSpeed Time.deltaTime) if(Input.GetKey (KeyCode.Q)) transform.RotateAround(player.position, Vector3.up, rotateSpeed Time.deltaTime)
|
0 |
How can I evaluate varying conditions in a Scriptable Object? I'm new to using Scriptable Objects, so this might just be a bit of confusion. Let's say we have a Scriptable Object that defines the abilities a character might have in the game, and a character class that triggers these abilities public class Ability ScriptableObject public string Name "New Ability" public int ManaCost 10 public Sprite AbilitySprite public void Execute(ref Character character) if (character.Mana lt ManaCost) return Do something, like instantiating and moving the sprite character.Mana ManaCost public class Character Monobehaviour public int Health 100 public int Mana 100 public List lt Ability gt AbilityList new List lt Ability gt () private void Update() Crude implementation for example purposes if (Input.GetKeyDown(KeyCode.Alpha1)) Abilities 0 .Execute(ref this) if (Input.GetKeyDown(KeyCode.Alpha2)) Abilities 1 .Execute(ref this) Obviously we can make numerous abilities with different mana costs, and add them to each character in the scene as needed some characters may have a "Bolt" ability, while others might have an ability that casts "Fire." The Execute() method will then evaluate whether or not the character can use these ability based on the character's current mana. But what if some of these abilities, all of which have similar effects, needed to also check the character's health, or perhaps a collision state, like isGrounded? For instance, maybe a certain ability can only be executed when the character has the appropriate mana value, and is also airborne. Would it be necessary to make many different subclasses of the Ability class to accommodate these different conditions, each with its own logic? At first I tried changing the Execute() method to take in a bool, like this public void Execute(ref Character character, bool canExecute) if (!canExecute character.Mana lt ManaCost) return The problem with this is that I have to hard code the conditions for canExecute and compare the current ability against its Name, and that sort of defeats the purpose of Scriptable Objects. My goal is to be able to create abilities that might need to check varying conditions while performing the same functionality, and assign them in the inspector to each character as needed.
|
0 |
Unity 5.5 Android scaling The questions I've seen are outdated, explained, not to my liking, or just don't work. Problem I want to be able to create a game that can scale on all mobile devices with ease and with no pixelation. Extra Info I'm very new to unity and tackling the the software with all my might I'm sorry for being a noob. I already paired unity with my phone and set the build to android (Nexus 5). Aspect ratio is 10 16, The game is going to be portrait. I have no scripts or anything, Its legit a blank game with a camera that has a blue background. I have some pictures, if you need anything else for my assistance don't hesitate I'm here to learn and take, GULP, Constructive Criticism. PC Android
|
0 |
Directory.CreateDirectory() created a folder with name that was supposed to be a file i am experiencing some problem here , i have a path " folder folderagain file.xml" i tried to use Directory.CreateDirectory() to create all folder (in case one of them is missing) and then reuse the path to create a file in another place inside the script. But instead a folder named "file.xml" was created by Directory.CreateDirectory() and my script got blocked from creating the file . I managed to solve this problem by creating 2 different path , one of them end with file.xml and the other does not. But is there any better way to do it ? can i tell Directory.CreateDirectory() to create only folder ?? look at screenshot below , there's System.UnautorizedAccessException error because my script trying to create file named "keymap.xml" but a folder with the exact name already exist so it thrown that error .
|
0 |
Animation imported from Blender into Unity via FBX doesn't play? I started building this model in Blender and gave it a simple animation that rotates the board about the axel. ...I exported it as FBX and imported it into Unity. I can see the animation is stored in the file when I import, but I can't find an animation file after I drop it in the scene, and there is no controller for the Animator controller it generated, either. I can watch the animation play in the FBX preview thumbnail but nowhere else. How can I get my animation working?
|
0 |
Vision Cone for Enemy AI in Unity 2d I am trying to develop an Enemy AI with vision cone in unity 2d top down game, can you please suggest me some approach or sample script, so I can get an idea.
|
0 |
Why do my point lights disappear when another nearby light is above 1.85 range? I'm making a game with a dungeon setting in Unity 3D. Many torches line the walls. I'm using a point light over each torch to simulate the flame. However, when two torches are across from each other, and one goes above the 1.85 range, the other disappears completely, giving off no light. What might be causing this?
|
0 |
Best way to create icon for UI , based on 3d model player can use in game I'm trying to figure the best way to create icon (for UI) from my 3d model (object) that player can use in the game. Maybe this is a silly question, but how do you create icon ? Do you create a new scene, place object and use a "shift print" to take screenshots ? Others way ? Thanks
|
0 |
Leaderboard not working in Unity I'm trying to create a leaderboard for my game. I have the game created and added the leaderbaord using cloudonce. I have also created the app on google play console and linked the app to the game services. I have followed the following tutorial to create the leaderboard Leaderboard tutorial I have followed the exact same instruction as given in the tutorial. Once the game is over, the leaderboard button is activated. I have attached LeaderboardsButton script(this script comes with the CloudOnce package) to the leaderboard button. Here is the code in the game over panel for getting the score void OnEnable() DisplayGameOverScore() void DisplayGameOverScore() gameOverScore.text ((int)gameManager.playerScore).ToString() gameOverHighScore.text PlayerPrefs.GetInt( quot HighScore quot , 0).ToString() CloudOnceServices.instance.SubmitScoretoLeaderboard(PlayerPrefs.GetInt( quot HighScore quot , 0)) This is the CloudOnceServices script as per the tutorial public static CloudOnceServices instance private void Awake() TestSingleton() private void TestSingleton() if (instance ! null) Destroy(gameObject) return instance this DontDestroyOnLoad(gameObject) public void SubmitScoretoLeaderboard(int score) Leaderboards.HighScore.SubmitScore(score) I have attahced this script to an empty game object along with the InitializeCloudOnce script(this is provided with the CloudOnce package). I have also created an alpha test on googleplay. Once I open the link and start the game, the google play services console open and when I hit the leaderboard button, google play services console loads but after that nothing happens. It just goes back to the game. I read that other people ran into similar issues and the advise given was to check if the SHA1 certificate fingerprint is the same in app signing under release management and the credentials in GoogleApis. They both match. I'm not sure what the issue is?
|
0 |
Creating a planet out of an existing terrain I am creating a game that I have created a terrain for. I really like the terrain so I am wanting to keep it but I want to have the game take place on a full planet. Avoiding paying 200 for an asset already made, how would I develop something to allow me to "tile" this terrain to make a full planet and to make it round instead of flat? I know this has to be somewhat possible with the expensive assets on the asset store that are for round terrains. I just need to figure out how and I can't find anything online that is much help.
|
0 |
How to upgrade a project in Unity Hub Before Unity Hub, it used to be the case that if you opened up a project that was from an older version, you would be prompted to upgrade the project. I am now on the latest Unity Hub 2.0.0 and I am trying to open a project that was last saved with 2018.2.1f1 but I am unable to. From installs, I am able to download and install the closest available version, 2018.2.21f1, but anytime I try to open my project I get the message Missing editor version 2018.2.1f1 on this machine. Select another version from the list or install the missing one. How can I upgrade this project like we did in older versions?
|
0 |
Get Prefab Asset From Gameobject in Edit Mode I want to get a prefab asset (that resides in Project Window) and assign it to a field like the one you get when you manually drag the prefab asset from Project Window to GameObject field But when I try to do the same thing in code (and in Edit Mode) with this function GameObject prefab instance PrefabUtility.GetNearestPrefabInstanceRoot(gameobj) as GameObject I get a prefab instance but not a prefab asset How do I get a reference to prefab asset from the gameobject that was created from it?
|
0 |
How to move objects across a canvas with consistent speed on different screen resolutions? I am making a rhythm game in Unity. I have been using Transform.Translate for moving images on a canvas as the music notes. However, I cannot consistently use this method on different screen widths. The notes move the same amount each frame. I want to use interpolation for my music notes. I want to have the notes reach the center of the canvas at the same time despite the width of the screen. How can I write such a script?
|
0 |
Why does setting a static member value in MonoBehaviour child class constructor have no effect? I am following a tutorial for Unity. I don't know C but I know other similar languages. I got the tutorial to work. Here is the script I used. using System.Collections using System.Collections.Generic using UnityEngine public class PlayerMove MonoBehaviour private Rigidbody rb public float speed Use this for initialization void Start () speed 3.5f rb GetComponent lt Rigidbody gt () Update is called once per frame void Update () float fx Input.GetAxis ("Horizontal") float fz Input.GetAxis ("Vertical") rb.AddForce (new Vector3 (fx, 0, fz) speed) This goes slightly against my C instincts, which are to put initialization values in a constructor. public PlayerMove () speed 3.5f void Start () rb GetComponent lt Rigidbody gt () This doesn't work. In Unity, the speed field has an initial value of 0. Why does setting the initial value in a constructor not work?
|
0 |
I have a problem rotating a 2D game object after collision I'm developing a simple flip game where a cube flips and the bar a it collides with should start rotating after collision. Most snips involve destroying an object, but that's not my case. Here is my code using UnityEngine public class CheckI MonoBehaviour float x public Rigidbody2D rb2d void OnCollisionEnter2D(Collision2D col) if (col.gameObject.tag "bar") x Time.deltaTime 10 transform.rotation Quaternion.Euler(0, 0, x) How do I start rotation after collision?
|
0 |
How to add a volume bar like YouTube for iOS? I am almost done with my game in Unity 5. However when the player presses Volume Up Down, the iOS (version) shows the standard UI to show volume. Android has it's own (looks better on Stock). I want to make my game consistent on either platform and different variations of Android. So I want to recreate how YouTube (for iOS) handles the change in volume. I can't figure this out. Any help would be awesome!!!
|
0 |
Unity scaling and animations In my Unity project I have a script that programmatically changes the scaling of an object during the game. Recently I wanted to add a spawning animation clip to my object, which modifies the object's scaling (but only during a short delay). So I added an animation controller to the object, containing the spawning animation clip. I can now successfully run the spawning animation but the in game programmatic scaling changes don't work anymore, even when my animation is not running. Any idea?
|
0 |
Unity 2018.4.25f1 Errors error CS0118 error CS0234 I am getting 2 errors in my c script. Assets scripts playerMovement.cs(8,5) error CS0118 'PlayerControls' is a namespace but is used like a type Assets scripts playerMovement.cs(4,19) error CS0234 The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?) playerMovement.cs using System.Collections using System.Collections.Generic using UnityEngine using UnityEngine.InputSystem public class playerMovement MonoBehaviour PlayerControls controls Vector2 move void Awake() controls new PlayerControls() controls.Gameplay.move.performed ctx gt move ctx.ReadValue lt Vector2 gt () controls.Gameplay.move.canceled ctx gt move Vector2.zero void Update() Vector2 m new Vector2(move.x, move.y) Time.deltaTime transform.Translate(m, Space.World) I am using the new Input System 0.2.1 in unity 2018.4.25f. The PlayerControls script is auto generated from an Actions Input object, and it is in the main root quot Assets quot .
|
0 |
Why does my tile palette not arrange nicely? I made my own Hex Point Top Tile sprite sheet, ensuring it's pixel perfect and align well. Slicing in Sprite Editor has no problem too. However, when I drag the sprite sheet to a new Palette in the Tile Palette panel, the tiles show up with random spaces. See screenshot below What did I miss? The sprite sheet is here, 30 x 30px offset, 24 x 24px padding, 66 x 66px tile size I'm using Unity 2019.3.10f1.
|
0 |
Using crittercism with Unity I want to use crittercism with my Unity project. In Unity I am developing a game for iOS and Android platform. I did enough Google searching to come to the conclusion that Unity doesn't support this by itself and there aren't much tools out there to help me. Can someone suggest a way to do it? If not, is it possible for me to get access to the editor logs of Unity programmatically so that I can send these logs to my server directly. (I'll however still need to know when a crash occurs.) I was thinking of a "hack". Please tell me if it is doable. On building the project, Unity creates an xcode project for iOS. I was thinking of opening the xcode project itself and putting the relevant commands to send the logs to crittercism, in case a crash occurs. However I am not able to think of a way to do this with Android.
|
0 |
Getting warning after importing plugin to unity5 project I am getting following warning when I import any plugin to my unity5 project.Whats the solution for this warning? Is there any problem with that which will affect my project.
|
0 |
Check Supported Platforms for Editor How can I find out from script(c ) did I download specific platfrom support for current Unity version?
|
0 |
Maintain Vuforia tracking during Unity Ad My game uses Vuforia pos and ground plane tracking. During gameplay players are given the option to watch a video to gain additional health. When 'No' is chosen gameplay resumes fine. However when 'yes' is chosen Vuforia tracking is lost during the video and afterwards all gameobjects are locked in a static position in relation to the AR camera. Is there anyway to maintain pos tracking during the video?
|
0 |
How can I stop transform.position from being modified when adding a child object? I suspect there is a well known and easy to explain reason for the behavior I'm seeing, but I am having difficulty explaining it (and likely not able to Google for the answer). When adding a child GameObject to a translated parent, the child's localPosition is modified so that the child's position stays the same after the parent's transformation is applied. Is there a way to not have this be the case? In the following example, I create a parent object and move it to (1,1,1), and then attach the child. I would like the child's position to be (1,1,1), that is (0,0,0) relative to the parent. However, the child's position is modified to be ( 1, 1, 1) so that it is (0,0,0) relative to the world. Here is a repro Create parent. GameObject parent new GameObject() parent.name "Parent GameObject" parent.transform.parent foregroundObject.transform Move the parent. parent.transform.Translate(1, 1, 1) Add a child under the parent GameObject. GameObject child (GameObject) GameObject.Instantiate(guildiePrefab) child.name "Child GameObject" child.transform.parent parent.transform PROBLEM localPosition is set so that the "global" position is (0,0,0). How can I add the child object and have its position be (1,1,1)? this.Assert(child.transform.localPosition.ToString() "( 1.0, 1.0, 1.0)") this.Assert(child.transform.position.ToString() "(0.0, 0.0, 0.0)") Is there a different way I should be adding child as a child of parent? Or, should I always zero out the position of parent before adding a child? If that is the case, any reason why I need to do this? What is the rational for this design choice?
|
0 |
Text mesh scaling camera distance relative I am searching a fromula that can maintain my text mesh size according to the distance from camera. I want that no matter my camera is near or far from text mesh my text show always with same width an height. I have tried this but the problem is still persist somehow float size (activeCam.transform.position transform.position).magnitude newLocalScale new Vector3(size 108, size 108, size 108) transform.localScale newLocalScale
|
0 |
Exclude a certain folder from Unity? I work with a small team of three people, and we use the collaborate service within Unity to share our progress. One of the folders we have inside our Unity project is an "OffGame" folder, which includes a tool I created specifically to help with the creation of certain assets. It's not actually supposed to be part of the game, but since I'm often making changes to it, I figured I'd include it in the Unity project. The Unity project temporarily makes use of certain files inside said OffGame folder, however, once the game is done, those files will be moved outside of that folder and integrated into the game proper. Since that OffGame folder is not supposed to be part of the game and I only included it there to share it to my teammates over the collaborate service, I don't want it to be treated like a normal folder for the game. Specifically, I don't want Unity to create a bunch of useless meta files for each file in that folder, or to act like a stray .js file in there is part of the project. I actually got compile errors because Unity kept thinking it had to include all the .js files in that folder. How can I make Unity ignore that folder?
|
0 |
Calling functions that needs to be on update() So I have a function DialogueRun() for a Dialogue System that changes the line on the dialogue box whenever you click. Which means it has to be in Update(). My test works so far but my next problem is how to make the whole dialogue box only appear whenever I click on a character. I tried making the characters as buttons and it does make the dialogue box show up whenever clicked, but it won't change the dialogue lines because that function has to be in an update method. I'm looking at OnMouseDown() right now but the result will be probably the same. Any ideas? public void DialogueRun() dialogueBox.SetActive(true) dialogue.text textLine nextLine if (nextLine lt textLine.Length 1) if (Input.GetKeyDown(KeyCode.Mouse0)) nextLine 1 else counter dialogueBox.SetActive(false) return
|
0 |
Unity Mobile How can we safely store our API key? We're making an app in Unity. We're building it for Android and iOS. We also have a server. In order to use our server you need to present our api key for the server. So, we need to store that key in the build somewhere (eg. APK file) But how can we put it anywhere where people wont be able to get it? Eg. they can get the APK and decompile it. SDKS for unity for facebook and so on, store an api key in the client. What do they do?
|
0 |
Jump script using AddForce not working I am making a simple jump script by adding a separate script to the character. I got the character from the Asset Store and I have left it untouched. I have searched the solution and similar problems to this, and I changed the force or JumpHeight to a pretty high value. But it is still nothing. The logs are printed out just fine. public class JumpScript MonoBehaviour public Rigidbody rb public float JumpHeight 7.0f Update is called once per frame void Update () if (Input.GetKeyDown (KeyCode.Space)) Debug.Log ( quot PRESSSED quot ) GetComponent lt Rigidbody gt ().AddForce (Vector3.up JumpHeight) Debug.Log (GetComponent lt Rigidbody gt ())
|
0 |
How long does one have to pay the 125 per month subscription fee for Unity pro? I'm a bit confused by how the subscription for Unity Pro works. If I were to get Unity Pro, do I have to keep paying 125 per month for as long as I'm using Unity pro? Or do I have to keep paying 125 per month until certain period, after which I am no longer required to pay anything? Furthermore, if I developed a game with the personal version of Unity and the game made over 100K, would that result in an immediate penalty or will Unity give me a deadline before which I must get Unity Plus Pro?
|
0 |
Effects of collisons broken glass, damaged cars, how are they created? My question is related in particular to achieving the effects of collision in game engine, how is this done? I have searched a bit, read from the internet and went through a few tutorials, and saw that one way to create one of the effects, explosion, or something breaking is to create the model in pieces, and apply force (in a game engine such as Unity 3D) to make the pieces fly off. It seems to be a solution, but it doesn't address the problem of items that are vaporized in a big explosion, with so many pieces. How is this done? Basic methods and tricks etc would be helpful. Secondly, the problem of things bending and getting damaged on impact, such as a car's front end destroyed when it hits a wall? How is this done? One thing that comes into my mind is to create each component of a car in a different state as an animation in 3Ds Max or Maya, and then in the engine, according to the collision, switch the model state in the time bar. Is this how it is done? Finally, what about materials, such as net of a basketball net, or a soccer goal net for example? Effects of ball hitting it can be calculated and applied in a script, but how to make the net bend and stretch with it? Is it done through models or materials? Also what about a flag fluttering in the wind? My questions are specific to game engines, particularly Unity3D. Some good links on the subject would also be helpful.
|
0 |
UI looks different between editor and in game I am very confused about Unity's UI system. This is how my inventory menu looks in the Editor And this is the view in game Settings Can someone please explain why this happens?
|
0 |
How do I change a value gradually over time? I'm using Unity3D 5 point something, and I'm planning on making a game where the player travels through a hot, dry desert, and so the heat causes the player's energy to deplete. The object of the game is to reach a certain point before the player's stamina runs out. What I was planning on doing is having different landmarks in the game world that the player can visit, and these will help replenish their Health or Stamina.
|
0 |
Do I have to commit the downloadable assets for Unity to the repo? Or a reference for the team to download them? QUESTION (Short version) I am going to use the Unity Test Tools asset to do unitary testing. Q Do I have to commit the Unity Test Tools to my repo? (using git, by the way). CONTEXT Team Workflow We are an indie team of 10 people (of which 4 coders, 2 graphics, 1 music, 2 marketing, 1 automation test QA), remotely located. We built the team 2 weeks ago, have explored Unity, decided that unity shall be our devel framework, and finally we did an internal silly tic tac toe internal for us to check the workflow. Now we want to start developing our 1st game. Clean code. Clean repo. Using git for version control. We configured Unity to write all forced in text and visible metas. We are using Unity5 free edition. Coding Up to now, I've managed to create a MVC schema. MonoBehaviour acts as the Controller and then we have non dependant classes that act as the Model of our game. The controller calls methods of this model. The model throws events to notify the changes in its state. We want to unit test the model. Assets Yesterday I discovered the Unity Test Tools. This is the only downloaded asset, the rest of the assets are made by us. The wonderings presented by this question may happen again if we download other assets or if we want to keep a common own made library across several games. QUESTIONS (Long version) As far as I've seen, assets get "copied" into your project. Okey for working. But... comitting?? I'm feeling uncomfortable. The same way in PHP you may use composer to handle "dependencies" so if you need a library you do not commit it inside your project, you just commit a text file saying "I want this library, this specific version" for the sake of example, you can tell composer to install PHPUnit for unit testing, and you commit the composer text file, you do not commmit a full copy of PHPUnit , these are our questions wonderings Q1) Do I have to commit all the Unity Test Tools in my repo? It is 10 Megas may seem an overkill or not, depending on your optics... but, as it carries "examples" and I don't know how to filter what is needed and what not, it seems so overkill to me to commit all of it but worse this might happen with another asset that is 500 Megas for example. Committing downloadable assets seems anti pattern. Do I have to commit? Q2) Or it is better that I don't, and have all the members in the team to manually download the Unity Test Tools? Q3) If they delete that repo and download it again, the Unity Test Tools seem to be kept local to the project, then a new download is imposed if it's not kept in the repo? Or Unity may store "local in your computer still global to your projects" things like "the testing library" you are likely going to use in several projects? Q4) Case one thinks "maybe each project needs its own version of libraries, best practice is do not keep anything global" then, committing them to the project still seems overkill... is there any standard of "config file" that I can place and then once the "git repo" is cloned, run some kind of "dependency installer" or so (much like the composer install action is to a recently cloned repo in PHP)? I've seeked for information, but I'm still confused on this. I've seen it exists something like an "asset manager" but I'm not sure if this is what I need. Any pointer to documentation I must read will be highly appreciated. Note that the documentation in Unity website, as for example this one Mastering Unity Project Folder Structure Version Control Systems does not address my specific question. Thanks!
|
0 |
How to call animation event from another GameObject I have an animation event but I want it to call a function from a script that is attached to a different GameObject that I'm not animating. Is this even possible?
|
0 |
2 cameras that each player sees through a different one Im very new to Networking in Unity 5. Im trying to bring the finished basis for my 2 player, 1 vs 1, turn based game I made for local multiplayer (both players on same computer) to an online matchmaking system. In the game currently (for local), there are 3 cameras. 2 centered on separate canvases for selecting attacks for each player. that once p1 chooses his attacks and presses continue, the camera is deactivated and the 2nd camera for p2's attacks is activated. Once p2 presses to continue the 2nd cam is also deactivated and the 3rd cam is put on, this camera is set on the battle arena and plays out in turns the moves picked by the 2 players through a turn determining system. What I want to do for the online is have both canvas cameras activated at the same time and each player to be assigned to a different camera. So is there a good way i should do this? NetworkView on one of the cams? Hope I explained the premise enough P
|
0 |
Transparent objects in the scene only get lit half way by point light I have encountered a weird graphics problem, where all of our transparent objects in the scene only get lit half way (only from the y position downward) by a point light. This happens with all of our grass and tree shaders. Also, when looking through translucent objects, they become really desaturated and gray is which is an undesired effect. Does anyone know how to deal with this problem? Please refer to the screenshots below. I'm are using Unity 2020.1.14f, built in render pipeline with a forward renderer. For grass and trees we are using the Fantasy Adventure Environment, but all other grass shaders from other packages have the same problem.
|
0 |
Why the spotlight is working only in scene view window but not in game view? What i did is disabled in the Hierarchy the Directional Light. The Spotlight is child of the character so it will move with it. Then in Window Lighting Settings In the Spotlight i just changed the range and rotation a bit. It's strange since it's showing the light in the scene view but not in the game view not even when running the game. And this is the Spotlight config
|
0 |
How can I instantiate and sync a LineRenderer in multiplayer network? I am trying to make a laser that will be visible to all clients in a multiplayer networked game on Unity. I've tried using a Command Attribute but that hasn't worked. I also found some ideas to use RpcClient but I am not quite sure how to implement that. The code I'm using for the laser (I just run the method in Update) is public void CmdActivateLaser(bool laserState) if (laserState false) return pointer.SetPosition(0, transform.position) RaycastHit endCommand if (Physics.Raycast(transform.position, transform.forward, out endCommand)) finalPos new Vector3(0f, 0f, endCommand.distance) pointer.SetPosition(1, finalPos) else pointer.SetPosition(1, transform.forward 500f)
|
0 |
Unity why game app on Android takes up much more memory than Unity Profiler reports? We are profiling a game app on Android 4.4.2 device via Unity s ADB profiling. We have set up ADB profiling following the official guide http docs.unity3d.com Manual Profiler.html The ADB profiling works fine, when the app is running, Unity Profiler reports its memory usage as following Used Total 100.4 MB Unity 40.5 MB Mono 10.1 MB GfxDriver 34.9 MB FMOD 3.9 MB Profiler 14.8 MB Reserved Total 112.8MB Unity 47.0 MB Mono 15.4 MB GfxDriver 34.9 MB Profiler 15.5 MB Meanwhile, we are also running another performance test tool (i.e. Emmagee, https github.com NetEase Emmagee) to monitor the app, which can monitor CPU, memory, network traffic, battery current and etc. However, the memory usage of the app reported by Emmagee tool is much larger As shown above, Unity Profiler reported 112.8M memory is totally reserved for running the app, but Emmagee tool reported 200M PSS memory is used. Obviously, more than 90M memory taking up is happened somewhere by something that Unity Profiler does not take into account. (We also tried other performance monitoring tool for Android apps, e.g. APT, and the result is similar to what Emmagee reported. The extra memory usage problem remains.) We noticed that the Unity Profiler itself would take up 15M memory, which is included in the profiler s report. Also, we knew that PSS memory includes proportional shared libraries with other processes, but 90M extra is such large amount considering that Unity Profiler only reported 112.8M totally. Our puzzle remained Where does the 90M memory come from? How are they used by the app? Why Unity Profiler does not report the extra memory? What can we do for reducing the extra memory and the total PSS memory of the running app, and or get it close to what Unity Profiler reports? Any help could be appreciated!
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.