_id
int64 0
49
| text
stringlengths 71
4.19k
|
---|---|
0 | No intellisense on my classes I've been using Monodevelop's current version and Unity 4. I don't get intellisense on the classes I've created but I do have intellisense on classes that are in Unity's framework. Bug or its just as it is? I use UnityScript class SomeClass extends ScriptableObject public function Test() return "" In another class, when I use a variable typed as this class I get no intellisense. |
0 | When should I use velocity versus addForce when dealing with player objects? I'm confused about these two methods in the Unity framework. Both make the player object move, stop, change direction, etc. When should one be used over the other and when is one appropriate? |
0 | Unity) What should i do if i want to change sprite animation in same action? My character has Idle Walk Jump Attack state in animator. and it can change its appearance when it gets an item. for example, it can equip sword or armor. and i need to change whole sprite. the sword and armor are not separate with body. which is best way to handle it? before get item) Idle Walk Jump Attack with sprite set 1. after get item) Idle Walk Jump Attack with sprite set 2. how can i change animation state after get item? do i make every animation state in Base Layer? |
0 | Detect walking on floor works partially I have a set of Gameobject blocks that form a floor with Box Collider and a GameObject with a Box Collider in it. My first hunch detecting hitting the floor was void OnCollisionEnter2D(Collision2D collision) print ("Enter " collision.gameObject.tag) switch (collision.gameObject.tag) case "Floor" isOnFloor true break This works well. However, when I want to check whether he left the floor (falling) void OnCollisionExit2D(Collision2D collision) print ("Exit " collision.gameObject.tag) switch (collision.gameObject.tag) case "Floor" isOnFloor false break The GameObject Drops down as soon as I move a little, as I get the OnCollisionExit2D method... How do I create a constant movement on a floor, and invoke "falling" only if I completely leave it? Thanks! |
0 | Code Logic's execution with respect to time Events I have to show complete 24 hours cycle in Unity3d Scene. Where different kind of task will be executed in different Times. Suppose at 2pm I have to move a car, at 6pm An Aeroplane will land on airport at 07 07pm I have to open the door of Market's Buildings and so on different task works execution at different timing. Now, I have some basic animation e.g., car, Aeroplane and door etc.,. Now I am confuse that how to play and stop my animation according to the time. And time can also be changed manually using GUI. If currently 6pm (animation working) then user can switch to 8am to view 8am time's animation (or code execution). And User can also fast the timing to view complete hours in a single minutes or in an hour. I can use if else in Update Events but I guess this is not the right way to do and will be very difficult if I require to show significant number of works in different time duration (which means significant number of if else statements). Just like below void Update() if(time 1) logic if(time 2) logic if(time 3) logic ... so on, tedious way ... and also not possible if time require between the hours, suppose 06 06pm What to do ? How to handle this? |
0 | How to show specific item in question on trigger entry? (Unity c ) So I have multiple, random objects on a plane, and when my player walks into them, I want them to be 'picked up'. The player can only hold one object at a time, and needs to return the item to the base before he can pick up another. Using the OnTriggerEntry function in a collider script, a set of commands are called when the player touches the object. Within the function, the 'itempickup' function from the player script is called using 'col.transform.SendMessage()'. How do I tell the itempickup function which specific object was 'picked up' in the trigger script? That is, is there a variable of some kind that acts as an ID for game objects? Thanks ) |
0 | Character bounces stutters down hills I'm using Unity3D (not 4) and I'm experiencing a bit of a problem with character movement. I'm using a capsule as a First Person player with a camera attached to it. In this capsule is the stock ThirdPersonController script (with the animation parts removed). I know it's not conventional, but it's not the problem in this case. The problem is when my character goes down hills, running or walking, it bounces down. It's as if it's going horizontally, then realising it's not grounded and then falling. It works fine going uphill but the downhill is driving me crazy. One solution that may be possible is raycasting, I know what it is but I have no clue on how to use it. |
0 | Emission for Mobile Shaders? I need to use Emission texture to my model, but I can't find any emission parameters in mobile shaders. I searched this on google, but there's nothing helpful to me. How do I add emission for mobile shaders, without writing own shader code? (I'm keep studying shader but still not good at) |
0 | What is wrong with my Item collection Itemcounter Script So I am making a script for item collection and a counter for it. I have a script made but for some odd reason I can't seem to the get the GUI part right. The compiler error says something like "This isn't a member of UnityEngineGUI" IDK what I am doing wrong. Could someone help out? pragma strict var Collectable GameObject var Counter int var CounterGUI GUI function OnTriggerEnter (other Collider) if (other.gameObject.tag "Player") Collectable.SetActive(false) Counter 1 CounterGUI.GUI Counter.ToString() |
0 | How to keep Unity data after reinstall? After the use uninstall reinstalls my app, all of his serialized data is gone. Is there a way to store a file on a mobile device permanently which persists through various installs? Without using a server cloud service or requiring the user to log into Google Play Games? |
0 | The 'speed' value of the Nav Mesh Agent component does not seem to affect speed at all (Unity3D C ) The speed value of the Nav Mesh Agent component doesn't seem to have any effect whatsoever on the speed of my game object. Actually none of the motion values seem to have any effect. I've attached photos of how I've set up my Nav Mesh Surface Plane and how I've set up the Nav Mesh Component attached to my game object. I followed an online tutorial to use the Nav Mesh Agent component via a C script. The object moves randomly just fine except that the speed and other values on the Nav Mesh Agent component don't seem to do anything. You will notice that there is a commented out 'randSpeed' public float variable that I experimented with. Changing that variable also did not affect the speed. Any ideas about this problem are appreciated. Thank you. public class RandomMovement2 MonoBehaviour UnityEngine.AI.NavMeshAgent navMeshAgent public float timerForNewPath private bool inCoroutine public float randSpeed Start is called before the first frame update void Start() navMeshAgent GetComponent lt UnityEngine.AI.NavMeshAgent gt () randSpeed navMeshAgent.speed Vector3 getNewRandomPosition() float x Random.Range( 40, 40) float z Random.Range( 40, 40) Vector3 pos new Vector3(x, 0, z) return pos IEnumerator doSomething() inCoroutine true yield return new WaitForSeconds(timerForNewPath) GetNewPath() inCoroutine false void GetNewPath() navMeshAgent.SetDestination(getNewRandomPosition()) void Update() if (!inCoroutine amp amp (Reaction2.stopMoving false)) StartCoroutine(doSomething()) |
0 | Unity 2019 build for Oculus Go not appearing on device My project was building fine in 2018 and showing up on my Go under "unknown sources". My project builds fine in 2019 and it says it gets installed but it no longer shows up under "unknown sources" or anywhere else that I can see. I can uninstall using adb so it's there apparently, but where, and how can I launch it? thanks |
0 | How do idle games handle such large numbers? Just wondering how games such as Tap titans and Cookie Clicker handle such large numbers. I am trying to implement an idle game however the largest number format supported by C is decimal. I am looking to support up to 10 500 that needs to be floating point How could I handle this? P.S. it needs to be cross platform i.e. pc, mac, ios, android and compatible with Unity |
0 | Issue with Sorting Layers with an NPC and Tilemap I have a weird thing happening, that I can't quite explain. I have two scenes, my starting town, and an Arcanist's shop. When I go into the Arcanist's Shop, the Arcanist NPC stays on the same sorting layer (background layer 0) as my checkered tiles, and the table is background layer 1. When I start the game, the NPC will switch between being "behind" the table, or on top of it whenever I reenter the Arcanist's Shop scene. It seems to switch between background layer 0 and 1 with no cause. I've double checked my sorting layers, they're all where they should be. I've checked the camera's culling mask, it's fine. I've checked to see if there are any weird components on anything in my shop scene, and there aren't See the image attached, this is the same instance of the game, just different times when I enter the Arcanist's Shop. Screenshot of my tilemap setup |
0 | How to create gui image with script So I've been fiddling around with the new UI system recently and one problem I have is adding images of my sprites to the ui. I know I can create a prefab of an image gameobject with the sprite I want, but I have hundreds of the sprites I want to add to the ui (They're different characters) so I don't want to create hundreds of prefabs. Instead, what I want to do is in a script, create an image gameobject, set its sprite, and child it to a parent panel in my canvas. Is this possible? |
0 | How can I pass an enum value to the OnClick method of a button? I am making a UI system for my game where I want to use an enum to define different UI modes. But OnClick function on button doesn't show method which receive enums. I heard I can pass an integer value to OnClick method and then somehow transform it into an enum. What can I do about it? |
0 | touch.phase TouchPhase.Canceled not worked i m tired to handle and solve issues related to multitouch. i m use maximume 5 touch simultaneously but when two touches are down on two object and i moved my fingures then that both touches fired TouchPhase.Ended event but not fired TouchedPhase.Canceled. I want to fired TouchPhase.Canceled when i my fingures out of those objects. if (touch.phase TouchPhase.Began) hitObject.GetComponent ().TouchDown (hitObject) if (touch.phase TouchPhase.Ended) hitObject.GetComponent ().TouchExit (hitObject) if (touch.phase TouchPhase.Moved touch.phase TouchPhase.Stationary) hitObject.GetComponent ().TouchStay (hitObject) if (touch.phase TouchPhase.Canceled) print ("Touched canceled....") hitObject.GetComponent ().TouchExit (hitObject) |
0 | how to check previous scene in scene manager in unity 3d I'm trying to make my first game using unity 3d and I'm trying to make a game over the scene that when you press the try again? button it should take you back to the previous scene, I was thinking of just making it with the code SceneManager.GetActiveScene().buildIndex 1)) then just place one after every level on the build index so that it takes to the previous level that the player was in, but I think this would just increase the file size (Idk if it actually does), so I was wondering if there is a more efficient manner on how to do this so that I could only have one Game Over Scene in the Build Index? |
0 | Rotate a 2D object slowly to the touch position in Unity I am creating a circular Joystick like setup in Unity. Played a lot with it in different ways but I don't get the desired results. void Update() movement Input.GetAxisRaw("Horizontal") if (Input.touchCount gt 0) touch Input.GetTouch(0) if (touch.phase TouchPhase.Began) firstTouchY touch.position.y if (touch.phase TouchPhase.Moved) if (touch.deltaPosition.y lt 0) movement 1 else if (touch.deltaPosition.y gt 0) movement 1 rotatePlayer() private void rotatePlayer() transform.RotateAround(Vector3.zero, Vector3.forward, movement Time.fixedDeltaTime moveSpeed) This is what I want. |
0 | 2D Spaceship Thruster Movement Turning I have a spacecraft (shown in the image) built out of blocks 3D planes. It is drawn within a 3D space, but I m ignoring the Y axis for now and keeping things on a 2D XZ axis. The ship has a number of thruster blocks (represented in blue) each of which should fire depending on user input (does the user want to go forward? or turn left? etc). Although the image doesn t show it, each thruster is oriented in a logical direction i.e the thrusters labelled A amp E point left, B amp F point right, thrusters G amp H point down, thrusters C amp D point up. Thrusters are placed arbitrarily around the ship. There is no actual 'Thruster A' or 'Thruster B' I'm just using the spacecraft in the above image as an example. I already have the following which works for forward backward thrust and strafing (in pseudo code) foreach(thruster in ship.thrusters) Forward thrust if(keyPressed W) amp amp thruster.direction ShipLocalSOUTH) thruster.fire() Backward thrust if(keyPressed S) amp amp thruster.direction ShipLocalNORTH) thruster.fire() Strafe Left if(keyPressed Q) amp amp thruster.direction ShipLocalEAST) thruster.fire() Strafe right if(keyPressed E) amp amp thruster.direction ShipLocalWEST) thruster.fire() Turn left if(keyPressed A amp amp ??) ?? Turn right if(keyPressed D amp amp ??) ?? class Thruster private thrusterPower 10 public void fire() shipRigidbody.AddForceAtPosition (thruster.transform.forward thrusterPower, thruster.transform.position) My problem lies in determining which thrusters to fire to turn the ship. I ve done a lot of googling on this and have found quite a lot of info already. I.e Using Torque and Thrusters to Move and Rotate a Player Designed Spaceship However my maths trig skills are to be blunt crap and so I m hoping to get a somewhat simpler explanation or even some code to help me understand and solve this problem. I'm not aiming for superbly accurate physics, just something that is fun to play. |
0 | How can I apply the changes in runtime? using System.Collections using System.Collections.Generic using UnityEngine public class AnimFlyertransportationController MonoBehaviour public GameObject JetFlame public bool turnOffOn false Start is called before the first frame update void Start() TurnAllAnimtorsOff(transform, turnOffOn) if (turnOffOn) JetFlame.SetActive(false) else JetFlame.SetActive(true) Update is called once per frame void Update() private void TurnAllAnimtorsOff(Transform root, bool onOff) Animator animators root.GetComponentsInChildren lt Animator gt () foreach (Animator a in animators) if (onOff) a.enabled false else a.enabled true I want that if in runtime I change the turnOffOn flag state apply the changes in real time in the Update for all Animators and also for the JetFlame. Now it's only aply the changes in the editor before running the game. |
0 | Unity 5.. How to Block interaction below panel? New to Unity...Is there an easy way to block all interaction underneath a panel that I would have stationary at top of my game. There will be a pause button in that panel and some game info. Just don't want the mouse input or clicks to go through the panel and interacting with game below. |
0 | How to refresh andoid photo gallery in unity After saving a screenshot into the folder i cannot view the screenshot in the android gallery but can see the screenshot in the folder created.Is there anyway i can see it through gallery? |
0 | Does marking a GameObject as static actually improve performance? I'm currently working on a small game that will include somewhat large levels. Each level will have a somewhat large amount of GameObjects lying around as props. I was told by a friend of mine that marking the GameObjects that the map is comprised of as static will improve performance. However, I am aware that this can greatly increase the amount of space the built game takes up on the disk. Does the performance boost gained from marking GameObjects as static outweigh the cost of increased build size? Is there even a performance increase at all? |
0 | Object pooling of different tpyes of agents (Mobile Game) in Unity The mobile game I am developing consists of one to four players and different agents that are being spawned and act in their own way. All those Agents (Car, Animal and Powerup) derive from the same base class 'Agent' which in turn has a field called 'rank' which represents something like 'low', 'medium' and 'high'. So an agent with rank 'high' will look and behave different than one being tagged 'low'. The thing is the 'rank' of the agent is determined at random. The max count of agents active simultaneously is known but this number is not in regard to their 'rank'. When objectpooling, this would lead to the follwing case There's a max agent count of, say, 6. This would require 6 instances of each agent with rank 'low' to 'high' to be created, altough some of those instances would never even be used. So my idea was to create only 6 gameobjects holding the components that each agent requires and use reflection to set the components fields according to the type. The problem is that some compoents which are unique to rank and type would need to be added and removed at runtime. What solution would be better in terms of runtime and memory performance? |
0 | Circle Collider Vibrates on Edge Collider I am making a game (kind of bricks) and using edge collider objects as world bounds collider. I am increasing count of balls on each iteration, after 5 balls, balls start to vibrate when they contact with edge colliders. Vibrating means, they do not bounce directly when they contact with edge collider, they vibrate on x axis for some period while they are moving upwards on y axis. Ball physics (friction is 0, bounciness is 1) Wall physics (friction is 0, bounciness is 0) I am not updating transform of ball object, directly set a velocity to balls. Also i've recorded a video for this behavior https www.youtube.com watch?v K bjkXZjXjs amp feature emb logo Which point i am missing on this setup? Can you help me to solve this problem? Best, Edit I have a input listener class, that updates BallThrowHandler.thrown variable, when you put your finger to screen, move and release. Code that adds velocity to balls (which is running on another object) using UnityEngine using System.Collections public class BallContainerBehaviour MonoBehaviour lt summary gt total speed of the balls lt summary gt public float totalSpeed 5f public float timeBetweenBalls 0.2f WaitForSeconds wait public float degrees 0f Rigidbody2D childBody Vector3 speedVector float cosinus float sinus void Start() wait new WaitForSeconds(timeBetweenBalls) void Update() if(BallThrowHandler.thrown) start throw animation startBallMovement() start ball movement if they thrown private void startBallMovement() calculateDegrees() speedUpBalls() if(BallThrowHandler.thrown) StartCoroutine("speedUpBalls") CollectBallHandler.CollectingBallsStarted false BallThrowHandler.BricksMovedDown false private void calculateDegrees() degrees Vector3.Angle(Vector3.right, BallThrowHandler.ThrowVector) Mathf.Deg2Rad private IEnumerator speedUpBalls() cosinus Mathf.Cos(degrees) sinus Mathf.Sin(degrees) speedVector new Vector3(totalSpeed cosinus, totalSpeed sinus, 0f) foreach (Transform go in transform) childBody go.gameObject.GetComponent lt Rigidbody2D gt () childBody.velocity speedVector yield return wait BallThrowHandler.thrown false And here is whole code for a ball object (only bottom collider is trigger, left right and top is not) using UnityEngine using System.Collections public class BallEndTurnBehaviour MonoBehaviour Rigidbody2D body public float ballMinY public GameObject bricksContainer private BrickSpawner brickSpawner private BrickTurnOverMover brickTurnOverMover private const float EPSILON 0.01f private void Awake() body GetComponent lt Rigidbody2D gt () void Start() brickSpawner bricksContainer.GetComponent lt BrickSpawner gt () brickTurnOverMover bricksContainer.GetComponent lt BrickTurnOverMover gt () private void Update() if(System.Math.Abs(body.velocity.x) lt EPSILON amp amp System.Math.Abs(body.velocity.y) lt EPSILON amp amp CollectBallHandler.CollectingBallsStarted) transform.position Vector3.Lerp(transform.position, CollectBallHandler.CollectingBallsPoint, 0.1f) private void OnTriggerEnter2D(Collider2D collision) if (!CollectBallHandler.CollectingBallsStarted) CollectBallHandler.CollectingBallsStarted true CollectBallHandler.CollectingBallsPoint transform.position CollectBallHandler.CollectingBallsPoint.y ballMinY body.velocity new Vector3(0, 0, 0) Vector3.Lerp(transform.position, CollectBallHandler.CollectingBallsPoint, 1f) if(!BallThrowHandler.BricksMovedDown) brickTurnOverMover.moveBricks() BallThrowHandler.BricksMovedDown true brickSpawner.spawn() |
0 | PS3 controller with Unity on Mac I am trying to use my PS3 Controller with Unity but it has been unsuccessful. I followed this video to do so https www.youtube.com watch?v LcettC1QHu4 I have done the same thing as the video but for some reason unity is not getting ANY input from the controller. I have tested the controller with another commercial game on my Mac and it works perfectly, so my controller is well connect to my computer. here is a screenshot of the input manager joystick button 0 is the X button |
0 | Unable to open project from a scene.unity file The tutorial I'm following has provided its project files, and I'm trying to open them in Unity. Here is the project download link. You can also go to the tutorial webpage and scroll down to download. I can't figure out how to do it. Here is what I've done. a) Extract zip to my Unity Scenes folder. b) Open Unity, create a new project called tutorial c) File Open Scene navigate to Unity Scenes voxeltut3 scene.unity d) Click Open It opens.. but then I don't see any of the tutorial's files in my project. There's none of the c scripts, no art, no prefabs... It's just the original empty project that I created. I also tried importing it as a new package e) Assets Import New Asset... select Unity Scenes voxeltut3 scene.unity f) Click Import And nothing happens. The Import New Asset dialogbox is still open with the scene.unity selected. It's like it's telling me that I've selected an invalid file. So I guess this is wrong? How do I open this tutorial project? I'm using unity 5.3.2 This is the folder structure the new Unity project that it created for me C Users me Documents Unity Scenes tutorial Assets Library ProjectSettings I unzipped the tutorial files in C Users me Documents Unity Scenes voxeltut3 Materials tiles.mat tiles.mat.meta Block.cs BlockAir.cs BlockGrass.cs scene.unity ... (other files) |
0 | Line Rendere Default Pink Color still Visible I am using the line Renderer for shooting in my game. Everything works well except for the fact that the default pink color is still visible. I have a Material set, so I do not think it is a problem of materials lacking. Someone Help please. |
0 | How can I stop showing camera image in my Scene? Unity How can I stop showing camera image in my Scene in Unity? As you can see on the screenshot there is an image of a camera inside a player in the Scene view. How can I disable the image? |
0 | Distinguish between HTC Vive controller grip buttons in Unity In Unity, I can check for grip button presses via the SteamVR API like so if(controller.GetPressDown(SteamVR Controller.ButtonMask.Grip)) ... This results in either true or false so I can only check if any grip button was pressed but not specifically which one. For Unity's Input API the documentation states 1 The grip trigger differs between platforms The HTC Vive controllers each have two grip buttons but both map to the same axis. The value for these buttons is 0.0 when not pressed and 1.0 when pressed (intermediate values between 0.0 and 1.0 are not possible). Source https docs.unity3d.com Manual OpenVRControllers.html In this case it is again not possible to differ between the two grip buttons. Is there any way in Unity to check which one of the grip buttons of a HTC Vive controller is pressed? |
0 | How to make a proper release build Unity Android x86, ARM32, ARM64 I'm trying to create a release on Google Play. I currently have Build App Bundle checked in the build settings, and it helps decrease the build size. In player settings I've IL2CPP set as the scripting backend, and x86 ARM32 ARM64 checked as target architectures. Once built it creates symbols.zip in addition to just aab. My questions are, Do I need x86 ARM32 ARM64 all checked? (I want to comply with Google's new 64 bit requirement) Can I build split aab's similar to 'split APKs by target architecture'? If so can I have the same version code for aab's which targets different architectures? Is there any advantage of doing so? |
0 | Detect Collision on Child Object I've created an obstacle prefab. The Prefab has following hierarchy. The player must die if he collides with Enemy. But It detects collision with parent object. I am also uploading the screen shot of property of enemy(Child Object) and Parent Object. What should I change to let player collide with Child Object (Enemy). |
0 | What are efficient strategies to support alternate spritesheets in Unity Context Let's suppose a classic card game, designed in Unity (say the latest release as of now, so 2018.2.16). Visible cards are GameObjects with SpriteRenderers (probably a Card prefab). One or several script objects are responsible of instantiating card objects as required, and inform each card of its current value the card then does whatever is needed to display the correct image. Now, here is the twist we would like to offer alternate sets of images for the cards (let say 10 designs) these alternate images would be included in the application itself (that is, on demand content is outside the scope of this question). Stating the obvious This is clearly a case for spritesheets. So at design time, pictures of each card of a set (52 regular faces, 2 jokers and card's back) are layout in a single image file (that is, one image file per card set design). So we have 10 spritesheets, each containing 55 sprites, and only one spritesheet (and therefore only one version of each of those 55 sprites) is to be in use at any given time. We want to avoid having unused images in RAM and or on the GPU. Therefore, only the currently selected spritesheet should actually be loaded. Question So the question is how to efficiently load, manage and use sprites in such situation? Envisioned strategies My first intuition would be to go for something along the line of Resources.loadAll lt Sprite gt ("CardSets CardSetName"). That is, each card set would be split in 55 sprites, stored in a directory specific to that card set. However, many sources, including some official documentation from Unity, discuss Resources as an old and undesirable subsystem, and recommend moving away from it. So let's consider other options... Suppose I am very patient and would not bother manually linking (or scripting in the editor...) every single sprites of every card sets, that is all 55 10 sprites, to some GameObject(s) inside the editor... Would it be reasonable? Would spritesheets for non selected card sets be loaded in RAM and or on GPU from the moment we open the scene, or only the spritesheet of the currently selected spritesheet? What if each card set is associated with a specific prefab instead, and I only instantiate the prefab corresponding to the currently selected card set? Alternatively, assuming that all spritesheets is packed using exactly the same layout, would it be possible make sense to reuse the sprite objects themselves, and instead swap their texture image? Would that be any better? How would one get access to these textures without having all textures be preloaded at scene creation, and yet avoid Resources.loadAll()? At last, what about sprite atlas? They seem a very good candidate for this problem, but the same questions goes as for texture replacements how would one get access to these textures without having all textures be preloaded at scene creation, and yet avoid Resources.loadAll()? And there might also be other strategies I am not aware of... Question (again) Now, this is a lot of subquestions, and I don't expect answers to all of these. Simply put, what would be a correct and efficient strategy to load, manage and use sprites in this example situation, based on current Unity's technology? Note 1 I know that this question is similar to How can I dynamically load the correct sprite from a sprite sheet? . I however think that is is significantly different in that 1) Unity's technology has evolved a lot since 2014 (official recommendations are now to avoid Resources.LoadAll(), and Sprite Atlas have been recently added) and 2) that other question considered only one card set, so it doesn't posed the extra issue of reducing memory usage. Note 2 I am not really making a card game this is only an example that make it easier to explain and present the core concepts that I want to clarify here (that is, proper strategies regarding management of alternate spritesheets). Please do not suggest that I draw text labels instead of having several sprites, that is not an applicable solution. |
0 | Public value null after assigning it from a different script Hello I am a beginner in Unity and still currently exploring with scripts. So I ran into a problem. In FetchAndAssign.cs Script void Start() GameObject theEdge GameObject.Find("Edge2") StallComponentAdder edge theEdge.GetComponent lt StallComponentAdder gt () edge. id id In StallComponentAdder.cs Script where it is attached to Edge2 GameObject public string id void Start () string storeID id print(storeID) When I try to print the storeID it won't print anything, why is that so? |
0 | Rotate around moving object I'm using the function Transform.RotateAround in order to make my player rotate around objects in my game, it's the main feature. The thing is, when I'm making my levels harder and make the objects (that the player rotates around) dynamic and add some movement on the X amp Y axis, the rotation movement is inconsistent, obviously, since the function recalculates each frame a different pivot to rotate around, the player distance from the object changes and not staying static throughout the rotation cycles. The question is, is there a way to get around this and make the player rotate around the object in a static, permanent distance from the object even though it's moving? Maybe by predicting the movement of the object or somehow quot diffusing quot the effect of the object movement..? Any comment would be helpful. Thanks in advance! |
0 | Unity2019 PrintDocument ignoring 'DefaultPageSettings.Landscape true' So I'm trying to print from Unity in landscape and while I can get it to print just not in landscape. So I create a PrinterSettings Object in 'void Start' and set the printer and tray from dropdowns... and that part appears to work but it's fully ignoring the Landscape property. public void ShowDialog(string filePath, bool isLandscape) PdfiumViewer.PdfDocument pdfiumDoc PdfiumViewer.PdfDocument.Load(filePath) printDocument pdfiumDoc.CreatePrintDocument() printDocument.DocumentName quot Print Document quot isLandscape isLandscape printPanel.SetActive(true) public void Print() int index paperSourcesStrings.IndexOf(SelectedPaperSource) printDocument.PrinterSettings printerSettings printDocument.DefaultPageSettings.Landscape isLandscape if (index ! 1) printDocument.DefaultPageSettings.PaperSource paperSources index printDocument.Print() printPanel.SetActive(false) |
0 | Creating the Vertices and Triangle Indices for Voxel Generated Mesh I am running into a problem with a compute shader I am writing to generate the vertices and triangle indices for a voxel generated mesh. Currently, I am creating an AppendStructuredBuffer of triangle structs which just have the three vertices of a triangle and reading from the AppendStructuredBuffer to the CPU. When read to the CPU, I then read from the buffer and set it in a RWStructuredBuffer in the GPU. Following that, I run a compute shader kernel to parse the triangle buffer. Obviously if I can do this all on the GPU I should since reading and writing between the CPU and GPU is expensive. When trying to put it all in one kernel I run into problems however. Each voxel has a range of possible triangles (0 5) that can form in it. Because of that, I can't simply use the dispatch ID to put it in a RWStructuredBuffer (at least I don't think so). That's why using an AppendStructuredBuffer seems natural it allows for the variable amount of triangles. After getting the array of triangle vertices and array of triangle vertex indices, I bring them back to the CPU and set them to a mesh and render it. In the future I want to use a geometry shader to render the mesh since that is most likely more efficient, but I'm trying to take this one step at a time, and geometry shaders are a whole 'nother beast I know nothing about. |
0 | Weird Animation Behavior in Unity I discovered a weird animation bug and have no idea how to solve it. Below you find the script I attached to my humanoid character. using UnityEngine using UnityEngine.AI public class PlayerCharacter MonoBehaviour private Animator anim private NavMeshAgent agent private bool dead false void Awake() this.anim GetComponent lt Animator gt () this.agent GetComponent lt NavMeshAgent gt () public void Kill() this.dead true this.anim.SetBool("Dead", true) void Update() if (Input.GetKeyDown(KeyCode.X)) Kill() public bool IsDead() return this.dead My character makes use of the NavMeshAgent and can walk around and idle everything works fine. But if I want to kill the player the dead animation loops continuously. This also happens if I change the death animation. This is my AnimationController As you can see, the transition has the condition "Death" with is set to true in the Kill() method. The code for walking and idling in combination with the NavMeshAgent is similar, but the script shown above doesn't work as expected and I have no clue why the animation starts to loop continuously (which looks a bit funny btw). Additionally the animation is not played to end, it restarts after a few frames. Any ideas? I could also post a video of the behavior if it would help. Thanks in advance! ) |
0 | How to store Unity Component after destroying a GameObject I have a collectible item, which I can put into the inventory. Its GameObject has a InventoryItem script attached in which I want to set all parameters needed for correct display in the inventory. Here is the C code InventoryItem.cs public class InventoryItem MonoBehaviour public bool collectible true public string name public Sprite sprite Part of ItemCollectingController.cs responsible of passing data to InventoryController if (Input.GetButtonDown("Use")) InventoryController inventory GameObject.FindGameObjectWithTag("Inventory").GetComponent lt InventoryController gt () inventory.AddItem(target.GetComponent lt InventoryItem gt ()) Destroy(target) Debug.Log("Added to inventory") And the important part of InventoryController.cs public List lt InventoryItem gt items public void AddItem(InventoryItem item) items.Add(item) When collecting the item, the GameObject is destroyed and so is the reference in the InventoryController. The items List keeps a missing component. What can I do about that? |
0 | Need to separate textures for Unity prefabs I'm a beginner at Unity and so I apologise if I'm asking a really stupid simple question. I have a number of 3d objects that were exported from a Blender project an then imported into Unity. I grabbed the texture out of Blender and reapplied it in Unity. Now I want to apply separate textures to each of the Prefab objects, but when I do, the texture change applies to all the prefabs. Likewise, if I try to duplicate one of the prefabs and apply a different texture, it applies to all of the prefabs. Can I separate the prefabs so that I can apply individual textures to each? Do I have to reimport the objects individually? |
0 | Unity Accessing a UI's text through a Transform I have this in my player's component list. The HungerTarget transform is the text box in the UI canvas. How would I change the UI's text here? using UnityEngine using System.Collections public class HealthHunger MonoBehaviour public Transform HealthTarget Not being used yet... public Transform HungerTarget void Start () void Update () set HungerTarget's text to ... |
0 | How to add Collider to a Line Renderer in unity? I have created a semicircle using a line renderer, I need to add a collider to this so whenever enemy objects hit this they get destroyed, how do I do this. Current Code using System.Collections using System.Collections.Generic using UnityEngine public class CreateCircle MonoBehaviour Start is called before the first frame update public float radius void Start() int segments 60 int pointCount segments 1 Vector3 points new Vector3 pointCount LineRenderer line gameObject.GetComponent lt LineRenderer gt () line.positionCount pointCount line.SetVertexCount(pointCount) for(int i 0 i lt pointCount i ) float Deg (i 60 segments) float Rad Mathf.Deg2Rad Deg points i new Vector3 ( Mathf.Sin(Rad) radius,Mathf.Cos(Rad) radius,0) Debug.Log(" Point " i " Deg " Deg " Rad " Rad " Vector 3 " points i ) line.SetPositions(points) Mesh lineMesh new Mesh() line.BakeMesh(lineMesh,Camera.main,true) MeshCollider lineCollider line.gameObject.AddComponent lt MeshCollider gt () void OnColliderEnter(Collider col) Destroy(col.gameObject) |
0 | 3D Menu Attached to an Object? So I'm gathering information for my project, and one of the things I want to achieve is to create a very sophisticated crafting system and weapon modification but I want the weapon customization to look in a specific manner. A very good reference would be Crysis weapon attachments system, where if you open it, your character tilts the weapon and there are few menus popping up, all attached to the weapon, so you can see the menus moving around as your weapon is moving (due to you breathing for example, or walking). Here is a quick image reference So 1st thing comes to my mind is, how in the name of god should I approach this? Pardon if this is quite easy thing to do, I'm just completely new to Unity. (I have solid C background so programming isn't the obstacle) Edit 1 To be precise, I'm wondering how to work out the positioning of the menus in relation to the weapon. So the menu is moving with the weapon and eventually even turn slightly to give that 3D'ish effect. |
0 | C Unity Multiplying Colors in loop results in wrong results Good day, I'm trying to generate a tilemap, my current setup is a base tileset, and a few overlays for the different biomes terrain heights. In my code, I generate each biome's tileset, based off of the base tileset, multiplied by the biome's overlay. However, as you can see in he image, it's reusing the first biome's overlay for all biomes. Preview of result Base Tileset Overlays Here's my code for (int i 0 i lt biomes.Length i ) StatusText.text "Generating Biome " i " Tileset..." biomes i .TileSet new Sprite tileSet.Length Creates the sprite array for the tileset of biome i . Color b biomes i .Overlay.texture.GetPixels() Gets biome i overlay in a color array. for (int x 0 x lt tileSet.Length x ) Debug.Log(biomes i .Name) Debug.Log(biomes i .Overlay) Color a tileSet x .GetPixels() Get's base tile x in tileset pixels. for (int j 0 j lt a.Length j ) a j b j Multiplies each pixel of the copy of base tile in the new color array with the overlay of biome i . Texture2D tex new Texture2D(8, 8) tex.SetPixels(a) tex.filterMode FilterMode.Point tex.Apply() biomes i .TileSet x Sprite.Create(tex, new Rect(0, 0, 8, 8), new Vector2(4, 4), 8) Creates sprite from generated texture. |
0 | How do I get to the Terrain Tools and Advance option in Package Manager in Unity? I am not able to find the Terrain Tools option in Package Manager when I search it. I am new to Unity and that's why I was following a tutorial. The video was about building a terrain and there he told to get the terrain tools first. For the terrain tools we need to go Window gt Package Manager gt Packages gt All Packages and then search it But in the Packages I don't have the All packages option and also I don't have the Advance option as told in the video. I am sure that the Unity editor in the video is of an old version. Currently I am using 2020.3.8 version of Unity. If there are some major changes between that version(used in the video) and my version(2020.3.8) then where do I find the Terrain Tools and the Advance option? Screenshot From My Computer NOTE If there are any confusions, please refer the video |
0 | Unity Behavior Designer get gameobject I am trying to create my own action in Behavior Designer. However i cannot seem to get the game object that designer is attached to. if i attempt to do protected Combatant enemyCombatantObject public override void OnAwake() enemyCombatantObject GameObject.GetComponent lt Combatant gt () base.OnAwake() It gives me an error the property or indexer 'Task.GameObject' cannot be used in this context because it lacks the get accessor Can anyone tell me how to get the GameObject that the script is attached to? |
0 | How do I make a fiery particle system? I added a particle system to the flame emitting object in my Unity scene. But it's just little white balls, and I can't figure out how to make it fiery. Anyone? Everything I see on the internet involves buying some asset pack that somebody put together. Does Unity really not have any built in flames stuff? |
0 | How to keep the ball on zigzag movement? I recently make a zig zag movement it works perfectly but after the ball hit the collider or obstacle the ball is changing their direction like just forward, not zig zag anymore I've tried to update the velocity after collide but it's same, also I have tried to constant the magnitude but that's not what I want here my script public float magnitude public float forwardSpeed public float horizontalSpeed private Vector2 horizontalAxis private Vector2 negationVector public Rigidbody2D rb2d public m GameManager GameManager public bool isOver false private void Awake() horizontalAxis Vector2.right negationVector new Vector2( 1f, 0) private void Start() GameManager FindObjectOfType lt m GameManager gt () UpdateVelocity() private void Update() if (Input.GetMouseButtonDown(0)) ReverseHorizontalVector() UpdateVelocity() private void ReverseHorizontalVector() horizontalAxis negationVector private void UpdateVelocity() Vector2 velocity GetCompositeVelocity() rb2d.velocity velocity private Vector2 GetCompositeVelocity() Vector2 forward Vector2.up forwardSpeed Vector2 horizontal horizontalAxis horizontalSpeed Vector2 composite (forward horizontal) return Vector2.ClampMagnitude(composite, magnitude) private void OnCollisionEnter2D(Collision2D collision) UpdateVelocity() private void OnTriggerEnter2D(Collider2D collision) if (collision.gameObject.CompareTag( quot Goal quot )) GameManager.IncreaseScore() if (collision.gameObject.CompareTag( quot L quot ) collision.gameObject.CompareTag( quot R quot ) collision.gameObject.CompareTag( quot Death quot ) collision.gameObject.CompareTag( quot Player quot )) StartCoroutine( GameManager.waitAfterDeath()) isOver true like I said before the ball zig zag but after colliding the movement change like that. |
0 | Simplyfing dissolving octree to simple boxes by adjacent octants with similar traits I am looking forward to create a navigation volume to be utilized by AI actors. The approach I am trying to tackle here is to first generate an octree and associate with respectable flags data (type, what's contained for now). The octree is going to be fairly deep (up to 0.1 units). This is the scene I am using for testing purposes results in 1947817 nodes in 9 levels. (22 x 9 x 22) I am looking for an algorithm concept pseudo code that would transform this octree into non uniform, axis aligned boxes derived from octants that match certain flags data, that would, for instance, help me determine the navigation volume similar to what can be seen here (Havok) With "I am looking for" I have a feeling of such an algorithm concept already existing, though, I am not sure. The feeling drives me towards this being a fairly mathematical problem that resides behind a common name. The other approach would be to utilize a non uniform grid (creates 4356000 cells) for the detailed shape to then be expanded (simplified) down to some boxes. Which my feeling tells, would utilize the same algorithm. As for the "what have you tried part" well... I have googled for some time with various combinations from keywords grid, merge, cell, flags, occupied, gamedev, octant, grow, largest space, adjacent and maybe some others to no avail. Well, before pushing the Post button, I did try some more keywords and ended up with this answer https gis.stackexchange.com questions 23365 how to combine adjacent polygons sharing similar trait into single polygon which appears to be close to what I am looking for, except that it's 2D (though, I gave the keyword "polygon" for this query). Having learned that the process is called "dissolve", I made some more attempts with various combos with added word "dissolve". And through my findings some more searches and so on... Well... nothing. If the answer wont yield any results, I know that I could attempt this by raying the hell out of the graph by starting at either corner and flooding through it all, basically, brute forcing my way. So... Is the common algorithm concept already out there, that I could be pointed towards? or what guidelines should I follow to produce such a product? |
0 | Using CNN's in Unity via Tensorflow and TensorFlowSharp I have a project that tracks hands made in python, shown here https github.com timctho convolutional pose machines tensorflow I want to effectively import this into Unity. I have generates the .bytes file from the model, but have no idea how to do anything further than this. If anyone has worked with ML Agents or TensorflowSharp in Unity and or would be willing to have a look, this would be great. The image processing stuff would be done probably in a C file beforehand, I just want to know how to run the network. Thanks. |
0 | How can I export mudbox joints to .fbx? When I export my Mudbox mesh (level 1), with its skeleton selected, to a .fbx and import it into unity, I don't get the bones joints skeleton whatever under my mesh in the hierarchy. Am I missing something? |
0 | Unity2D Apply gravity to some items, when everything else is gravity free? Sorry for the incredibly vague title Let's say you have an NPC, and when he dies he'll spawn items, coins for example. Instead of just pushing the coins in random directions it would look a lot neater if they coins arced to the ground (see picture below) The red circle represents a dead npc, the black lines represents gold coins. Every entity in my game has a RigidBody2D with gravity set to 0, otherwise they'd fall to the bottom of the gray box. Is it possible to 'pretend' that the ground around the dead npc has collision? I thought about maybe adding a collision box below the coins which follow the coins in the X dimension only, but I'm not sure how to set the coins to only collide with these boxes (and perhaps left and right walls) |
0 | Unity3D Directional lights vs Draw calls I need 2 light sources looking at a different direction as per my design. This means, I cannot flag one of them as 'not important'! I found that because I'm using 2 directional lights, drawcalls are aggrevated. Can somebody provide me a direction. With one DL 7 draw calls. With 2 it goes to 60 odd. It is the same case if I switch them vice versa. |
0 | Weird blue shine on URP Lit shader Unity I recently started to use URP and I am noticing a weird blue like tint on shiny objects that use the URP lot shader and I can't understand what it is and how can i remove it. |
0 | 2D snake game ( how to rotate snake's head with movement ?) I want to know how to rotate snake's head with movement how to make tail prefabs (body) follows head direction. public class Snake MonoBehaviour bool ate false bool isDied false public GameObject tailPrefab Vector2 dir Vector2.right List lt Transform gt tail new List lt Transform gt () void Start () InvokeRepeating("Move", 0.3f, 0.1f) void Update () if (!isDied) if (Input.GetKey (KeyCode.RightArrow)) dir Vector2.right transform.rotation Quaternion.Euler(0, 0, 180) else if (Input.GetKey(KeyCode.DownArrow)) dir Vector2.up transform.rotation Quaternion.Euler(0, 0, 90) else if (Input.GetKey(KeyCode.LeftArrow)) dir Vector2.right transform.rotation Quaternion.Euler(0, 0, 0) else if (Input.GetKey(KeyCode.UpArrow)) dir Vector2.up transform.rotation Quaternion.Euler(0, 0, 270) void Move() if (!isDied) Vector2 v transform.position transform.Translate (dir) if (ate) GameObject g (GameObject)Instantiate (tailPrefab, v, Quaternion.identity) tail.Insert (0, g.transform) ate false else if (tail.Count gt 0) tail.Last ().position v tail.Insert (0, tail.Last ()) tail.RemoveAt (tail.Count 1) void OnTriggerEnter2D(Collider2D coll) if (coll.name.StartsWith("Food")) ate true Destroy(coll.gameObject) else isDied true |
0 | Unity Bypass Ctrl S in a custom Editor Window Is there a way to bypass Ctrl S for Windows or 8984 S for Apple default behaviour (save scene) in a custom editor window? |
0 | How do I pause and unpause gameobjects on is own in the scene without pressing keys in unity3d I can't get my gameobject to pause or unpause in the scene in Unity3d. I need the game to pause for a couple of seconds maybe longer than unpause by itself. Here is my script using UnityEngine using System.Collections public class hu MonoBehaviour GameObject pauseObjects public bool isPaused void Start () pauseObjects GameObject.FindGameObjectsWithTag("Player") Update is called once per frame void Pause () if(Time.timeScale 1) Time.timeScale 7f else if (Time.timeScale 8f) Time.timeScale 1 |
0 | Unity3D Efficiently loading chunks in an infinite voxel engine I'm developing a voxel engine in C using Unity and I'm currently trying to implement infinite terrain, so I took a look at other Unity voxel engines that have infinite terrain. I've seen three different ways of doing it Using a dictionary to store the chunks and store the block data in another dictionary Using a dictionary to store the chunks and store the block data on every chunk Using a fixed size array and shifting it every time the player moves The engines using approach 1 and 2 were pretty slow at chunk loading. The engines using approach 3 were faster but produced lag every time the player entered a new chunk. I've already tried to implement it using approach 1, but my chunk loading speed got slower by about 10 times, so it was really unplayable. How is it done in efficient or popular voxel engines like Minecraft or VoxelFarm? Do you have experience with voxel rendering and know a better approach? Thanks in advance! |
0 | UnityTeams Files to publish but no Upload button I am using Unity 2019.2.14f1 to build a game. As I am working with a team, we have decided to use Unity Teams for the collaboration. The project escalated and we ended up having to architecture a different project structure, directories and files. Due to that, I created standard folders, deleted others, moved files. Changes were made, the project was saved and now I see the blue icon in the majority of folders and lots of items in the Project Folder. If I look at the Collab button on the top right corner of the screen and hover the mouse it appears the message You have files to publish However, if I press the button, even though it shows the blue icon, that shows that I have files to upload, it appears You are up to date! This is the first time I saw this problem. I have done some changes to one of the scenes to see if the problem disappeared, however it persists. I have been waiting for quite some time now, and decided to ask you for some guidance. Everything is fine with the network connection. In this particular situation, the log system that will appear when I upload the files is going to be huge. Is this be the reason behind the problem? What shall I do to solve this? |
0 | Why does occlusion culling have a negative performance impact on Gear VR in Unity 5.4.03f? I am making a GearVR game using Unity 5.4.03f and Oculus Utilities for Unity 5. I have problem with Occlusion Culling. I've set appropriate objects as static and baked the data. The culling works correctly when I visualize it in the editor I set a complex scene and hid it behind a big cube. The scene is not rendered when visualizing in the editor when the camera is behind the cube. When I deploy this scene to the device, Samsung Galaxy S6. The culling does work when looking at the complex scene through the occluding cube, I have good a framerate, the scene is culled. Without the cube and occlusion culling, the FPS would be around 40, with the cube and OC, it is around 60. The problem starts when I get past the cube with OC on the FPS drop to 30, while without OC in the same spot they were around 55. I tried looking online for solutions, but this is supposed to be an old bug that was fixed back in Unity 5.1.X. Any ideas? |
0 | Empty game object (child of player) not changing position correctly when key pressed I've made an empty game object which is the child of the player. It is by default on his right side and following his every move, and I want to make it so that every time a directional key is pressed (WASD) it changes position and stays there. But the way I've made it, it's not working as intended and seemingly goes to random positions every time. Here's the script using System.Collections using System.Collections.Generic using UnityEngine public class ChangePositionAccordingToKey MonoBehaviour Start is called before the first frame update void Start() Update is called once per frame void Update() if (Input.GetKeyDown(KeyCode.W)) transform.position new Vector3( 0.58f, 3.09f,0) This is probably a dumb question but I am new to coding so I can't figure it out. Any help is greatly appreciated |
0 | How to combine the camera that follows the player and the camera shake effect in Unity? I need to combine both camera that follows the player and the camera shake effect in the same moment. The problem is in that, if I make the shake effect for the camera, then the camera doesn't follow the player and if I make the camera follow the player, then the shake effect doesn't appear. The basic idea of my script is next Vector3 originalPos GameObject targetPlayer bool canShake void OnEnable() originalPos camTransform.localPosition void Update() Camera shakes if (CanShake) transform.localPosition originalPos Random.insideUnitSphere shakeAmount Camera follows the player else transform.position new Vector3(targetPlayer.transform.position.x, transform.position.y, transform.position.z Does anyone have ideas how to combine these two things (camera shake effect and camera that follows the player) at the same moment? |
0 | Unity2D Click to move Snake Game I'm trying to create a click to move snake game on mobile but I'm having problems with the whole click to move functions and adding a body part every time my snake eats an apple. I want to make the click to move smooth you know like an actual snake is slithering around and when the snake eats an apple, I want to add another body part to my snake (maximum of body parts should be 5). Can anyone point me into the right direction or give me an example of what to do, thank you! |
0 | How to share Unity High Scores on social media (Facebook , Google and Twitter)? This may be a common question but as a n00b I have some confusion on achieving this . I am on a small game project and I want the user to share his her scores on social media after completing the game . When they post , it should be something like "Hurrayyyy ! I Scored 12345 on My Game App Name , Can you beat my score ? Try it ." where ' My Game App Name ' and 'Try it' should be a link directing to Google Play Windows Store etc . My Idea is like this Here Share This on Facebook , Share This on Google and Share This on Twitter are 3 UI Images with Button component attached to them . So when the player clicks on those buttons , they should post on social media . So how to achieve this ? I got something here , but I don't know how to use that . I will prefer not to use Facebook Unity Plugin . So can I achieve this ? I need code in c , not in JavaScript ) I hope you will help me to figure this out . Regards , NB ) |
0 | Android game crashes when attempting to start wifi hotspots I have two methods that will try to start the WiFi hotspot on the android device so that others can connect and play the game.the problem is both method have problems and don't work. the first method public void ConnectWiFi() try using (AndroidJavaObject activity new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic("currentActivity")) using (var wifiManager activity.Call("getSystemService", "wifi")) AndroidJavaObject wifiConfiguration new AndroidJavaClass("android.net.wifi.WifiConfiguration") wifiConfiguration.Set("SSID", meSSID) string wifiConfiguration.Set("preSharedKey", mePassword) string wifiManager.Call("setWifiApEnabled", wifiConfiguration, enabled) catch (System.Exception E) T.text " nE " E.Message T.text " n t" E.StackTrace " n" it crashes the game and I can't debug it. the secont method public void ConnectWiFiHardWay() try using (AndroidJavaObject activity new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic("currentActivity")) using (var wifiManager activity.Call("getSystemService", "wifi")) using (AndroidJavaObject classObj wifiManager.Call("getClass")) using (AndroidJavaObject wifiConfiguration new AndroidJavaObject("setWifiApEnabled")) wifiConfiguration.Set("SSID", meSSID) string wifiConfiguration.Set("preSharedKey", mePassword) using (AndroidJavaObject wifiCfgClass wifiConfiguration.Call("getClass")) using (AndroidJavaObject booleanObj new AndroidJavaObject("java.lang.Boolean")) using (AndroidJavaObject booleanClass booleanObj.Call("getClass")) using (AndroidJavaObject methodObj classObj.Call("getMethod", "setWifiApEnabled", wifiCfgClass, booleanClass)) methodObj.Call("invoke", wifiManager, wifiConfiguration, enabled) catch (System.Exception E) T.text " nH " E.Message T.text " n t" E.StackTrace " n" this one throws an exception that says setWifiApEnabled Cannot be found I can post the complete error text if that helps. Also I followed this questions instructions. |
0 | how to make a seemingly endless backdrop in Unity Potential solution at the bottom. I have a rocket which flies straight up, as it gets higher you can see the edge of the terrain. I want the rocket to eventually leave the atmosphere and then the landscape to disappear from view as the player would be so high up. How do i make it appear that the landscape is endless? image pre launch image post launch My solution to anyone who has the same type of question firstly i made a mountain range using the terrain, a 3x3 tiled one worked for me. I then used the lighting settings to add fog to the scene, to slightly obscure the mountains. Lastly i rotated the camera upward by 5 when the rokcet reached a certain position to further hide the blankness behind the mountains. images shown below pre camera rotation post camera rotation |
0 | Lightmapping runtime combine children Is it possible to have lightmapping on runtime generated combine children in Unity? It is possible to bake combined meshes when they are done in the editor, but the .apk .ipa size increases too much. |
0 | Oculus Rift DK1 and DK2 compatability issues For a project I need to make a multiplayer game using Unity and the Oculus Rift. My project works fine with the DK2 but it turns out the second rift is a DK1 and it won t work with Unity. I was thinking the best way forward would be to use an older version of the Oculus Runtime and Unity. Does anyone know what versions of Unity and the Runtime I need to have both the DK1 and DK2 work with Unity? |
0 | Unity3D Get object size in order to be used in Vector3 coordinates I have a plane in Unity in 3D project, and I want to get its boundaries so I can use them in random function for getting Vector3 coordinates. Currently I am trying like this GameObject ground void Start () ground GameObject.Find("Ground") moveAreaX ground.GetComponent lt Renderer gt ().bounds.size.x moveAreaZ ground.GetComponent lt Renderer gt ().bounds.size.z Debug.Log ("X Area " moveAreaX ", Z Area " moveAreaZ) GetRandomTargetCoords() void GetRandomTargetCoords() targetCoordsX Random.Range(0f, moveAreaX) targetCoordsZ Random.Range(0f, moveAreaZ) targetCoords new Vector3(targetCoordsX, 1.1f, targetCoordsZ) And in the console I am getting this X Area 108.5801, Z Area 108.5801 The problem is the units provided by this bounds.size are not equal to the game object's Transform position's units, and so the game object gets out of the Plane's boundaries. How can I make it have the same units for measurements? |
0 | Unity 5.5 and Parse 1.7.0 on iOS 64 bit We are using Unity 5.5 and Parse 1.7.0 (and Firebase for notifications) which doesn't have "Parse.Unity.dll" and while on Editor everything is working fine but when we build using "IL2CPP" on iOS while running on device the game produces an error of "MissingMethodException No constructor found for Parse.Common.Internal.FlexibleListWrapper 2". I think it's because of stripping, I've tried to include "Parse.Core" and "Parse.Common" in "link.xml" but still same error while I was looking for solutions I found that there's a file "Parse.Unity.dll" that should have been in the project from the start but when I try to include it in our project another error but this time in Unity Editor that says "System.Threading.Tasks.Task is defined multiple times" and that's because I think the new Parse.Unity.dll and Unity.Task.dll from Firebase, if I try to delete that firebase Dll another error appears.... Please any help is appreciated ( We have to build with il2cpp to upload on the App store, Android version works fine. |
0 | Basic billiards game Can't detect collision between cuestick and cueball I have a basic Unity project on GitHub. Basically, I have a Cuestick that aims and shoots using the mouse. You can rotate around the cueball with your mouse and when you're ready to shoot, you can hold down the right mouse button and move the mouse forward. The game came follows the cuetip. However, the collision between the cuestick and cueball is wonky. The cuestick protrudes through the ball and only pushes the ball forward only a little bit. I've created rigid bodies and colliders for both cuestick and cueball. I've set the cuestick's rigid body to kinematic (if it's unchecked, the poolstick will barely dent the ball). I've tried using OnCollisionEnter and a Debug.Log statement to no avail. Any help would greatly be appreciated. You can find my scripts in GameLogic (they're F sharp scripts whose binaries get compiled and outputted into the assets folder). |
0 | How to rotate and move an object in precise time frame My task is to rotate and move an object into a new position and rotation in a given time. Say I have to move a cube from (0,0,0) (0,0,0) to (1,1,1) (0,90,0) in 5 seconds. Could anyone explain to me please how to achieve that? My experiment is private IEnumerator DoMove( float time, Vector3 targetPosition ) foreach(WayPoints wp in tposes) float counter 0 float duration wp.timeStamp while (counter lt duration) counter Time.deltaTime Vector3 curpos cube.transform.position Quaternion crot cube.transform.rotation float time Vector3.Distance(curpos, wp.position.position) (duration counter) Time.deltaTime cube.transform.position Vector3.MoveTowards(curpos, wp.position.position, time) cube.transform.rotation Quaternion.Lerp(crot, wp.position.rotation, time) yield return null Debug.Log( quot Reached position quot wp.position.position quot in time quot Time.time) The cube gets to its position in time, but rotation is late. The end position of the cube should be (2,2,2) (0,120,0), but it stops moving at (2,2,2) (0, 110,0). There are two positions I want the cube to be in (1,1,1) (0,90,0) in 5 seconds (2,2,2) (0,120,0) in next 4 seconds |
0 | Animating child objects via parent object animator in script I'm using unity 5 I'm trying to animate multiple child objects via a parent object. The animation worked in the animation view but would not work when I tried to preview the game. In the script I use the code ParentObject.GetComponent lt Animator gt ().Play("intro") to play the animation. A similar line of code worked when playing a singular object, not sure what's going wrong now, any sugestions? |
0 | Unity camera moving up and down for no reason I have a standard camera in my scene. With standard I mean the camera you get when you click right mouse Camera, with no modification except for the transform position and rotation. Then I attached to the camera this simple script using System.Collections using System.Collections.Generic using UnityEngine public class CameraController MonoBehaviour public GameObject target public Vector3 translationOffset public Vector3 rotationOffset Use this for initialization void Start () Update is called once per frame void Update () transform.position target.transform.position translationOffset transform.LookAt(target.transform) transform.Rotate( rotationOffset) the result I have is this Why my camera is doing that? It may be worth noticing that everything was working fine, but at some point i clicked on "reimport all assets" and it started this weird behaviour. How can I fix? Thanks a lot. |
0 | How can I make it not possible to type after reaching a max number of lines in my textarea? I have a EditorGUI.TextArea that is 300x100 in size. How can I make it impossible to type after reaching a max number of lines in my textarea (no wrapping)? |
0 | Disconnecting Power Flow from Source I'm trying to design a wiring system that allows players to connect power sources to switches via wires. Think redstone in Minecraft. When a wire is placed, if it is not initially connected to the power source, it has no power (behaving as expected). The PROBLEM occurs when the wire is connected to power, detecting that it is powered, and then disconnects from power. After it has touched the power source, it then becomes it's own source if disconnected, which is not what it should be doing. This is what SHOULD be happening Here's what is ACTUALLY happening And here is my code using System.Collections using System.Collections.Generic using UnityEngine public class Wire Moveable MonoBehaviour public static Wire Moveable control public bool IsBlue public bool IsRed public bool powered void Start () IsBlue false IsRed false void Update () if (Input.GetMouseButtonUp (0)) following false this.gameObject.GetComponent lt Wire Moveable gt ().SnapWire () void OnTriggerStay2D (Collider2D trigger) if (trigger.tag "wire") if (trigger.gameObject.GetComponent lt Wire Moveable gt ().powered) powered true if (trigger.gameObject.GetComponent lt Wire Moveable gt ().IsBlue) IsBlue true IsRed false else if (trigger.gameObject.GetComponent lt Wire Moveable gt ().IsRed) IsBlue false IsRed true void OnTriggerExit2D (Collider2D trigger) if (trigger.tag "startnode blue") IsBlue false powered false if (trigger.tag "wire") if (trigger.gameObject.GetComponent lt wire Moveable gt ().powered) powered false void SnapWire () if (this.gameObject.name "Wire Basic" this.gameObject.name "Wire Basic(Clone)") StartCoroutine ("ActivatePower", 0) IEnumerator ActivatePower () yield return new WaitForSeconds (0.1f) if (powered) PowerBeam.SetActive (true) else if (!powered) PowerBeam.SetActive (false) |
0 | Making pickup objects with gravity that won't push the player on collision I am trying to create pickups, that appear after an enemy dies, and that the player can pick up, but I am running into some issues. First of all, I want the pickups to be affected by gravity, so I need a rigidbody2d and a boxcollider2d (non trigger), so this works. Now, if I want to collect the pickups on contact, I need to make the layers for the loot and the player get in contact, so that they can interact. Now, of course, I do not want to push the pickups around. I want to actually pick them up when I touch them, but the collider is not a trigger so I thought I would use OnCollisionEnter to handle this. void OnCollisionEnter2D(Collision2D other) var loot other.gameObject.GetComponent lt ILoot gt () loot?.PickUp(gameObject) Destroys also the pickup While this works, I am still using a non trigger collider, which means that there are some physics effects that are not desired. For instance, when I quot jump quot onto the pickups. Notice the subtle, but still present, slowdown in the fall, when the player enters in touch with the pickups? How could I solve this issue?? |
0 | Build displays black screen with static Something really odd happens when I'm trying to load a scene. It is supposed to look like this (it also has to show the next scene after loading) What is going on? |
0 | Not able to upload to Oculus Store I am building for Quest and signing the package with V2. I am also creating store based Android Manifest file. Unfortunately the upload stops at 2nd step where I receive the error quot The APK was signed with the V1 signature system, previously marked with V2 and signed again with V1. Such APKs are considered corrupted and cannot be installed. quot Here is my Android Manifest file lt manifest xmlns android quot http schemas.android.com apk res android quot package quot com.VR.VRCube quot android versionCode quot 1 quot android versionName quot 1.0 quot android installLocation quot auto quot gt lt application gt lt meta data android name quot com.samsung.android.vr.application.mode quot android value quot vr only quot gt lt meta data android name quot com.oculus.supportedDevices quot android value quot quest quest2 quot gt lt activity android screenOrientation quot landscape quot android theme quot android style Theme.Black.NoTitleBar.Fullscreen quot android configChanges quot density keyboard keyboardHidden navigation orientation screenLayout screenSize uiMode quot android launchMode quot singleTask quot android resizeableActivity quot false quot gt lt activity gt lt application gt lt uses sdk android minSdkVersion quot 21 quot gt lt uses feature android glEsVersion quot 0x00030001 quot gt lt uses feature android name quot android.hardware.vr.headtracking quot android required quot true quot android version quot 1 quot gt lt manifest gt |
0 | Unity Physics.Raycast give false positive while using layer mask I'm very new to Unity so please excuse my question if this sounds very basic to you. I'm following various tutorials and I have a small question regarding Physics.Raycast if (Input.GetButton("Fire1")) check ground hit first RaycastHit hit if (Physics.Raycast(ray, out hit, LayerMask.GetMask("Ground"))) Debug.Log(" PlayerMotion Hit" hit.collider.name " " hit.point) agent.SetDestination(hit.point) Here, even tough I expressively set the layer mask to "Ground", I still get a hit with the Player game object itself (the ground hit is working fine). I thought ok maybe I put the "Ground" layer as well on the player by mistake but I checked several times and it's not the case. I'm attaching a gif so you can see what's the issue exactly There's an easy by checking the collider.name but I still find it odd that the Raycast gives me a false positive with the player hit. Any idea what's going on ? |
0 | Creating valid virtual creature with 3d Boxes I'm creating this project in unity.Karl Sims, the creator of the project, published the paper describing the project. In order to create the 3d creature like in the video, I'm using 3d boxes and BoxColliders. The boxes are connected to each other with a ConfigurableJoint that limits their rotation limit on some axes. The creatures are then trained to learn different behaviors. In order to create a new creature a tree is defined. A node in the tree includes data about itself like size or rotation limits, and connections to its children. Each connection includes the rotational limit of its children. Collision is enabled between the nodes. This system results in many different looking creatures. Some of them can't actually exist. For example, a creature with two nodes that are long boxes connected side to side really closely, but their connection also says one of them needs to be rotated by 90 degrees. This creature will cause colliders to be in one another, which results in a fight between the Colliders pushing the boxes away, and the ConfigurableJoints pulling the boxes to each other. This results in the boxes moving around in an unnatural way. These creatures need to be eliminated. I'm looking for a way to have as many valid creatures as fast as possible. Currently, I'm still using the same random creature generation method. After that, I add a Validator which that instantiates the creature's body and performs some checks. The validation checks I tried are 1. See if the creature is not moving 2. See if the colliders overlap with Physics.OverlapBox (I think this didn't work because regular creatures are also colliding and so it eliminated valid creatures) 3. See if there is an unreasonable force acting on the joint, which would indicate an overlap. This seems like the most promising, and I'm still testing it. The thing is that the creature learned to cheat this, during validation they didn't overlap, and when I added their control system (The brain of the creature) they push themselves to overlap. 4. Check for extreme accelerations out of nowhere. Had some success but the creatures adapted to the limit I set. Currently, I'm leaning towards making the creature will a very small mass, so they don't need to apply a lot of force to move. I think this can help make detecting unreasonable forces easier. Hopefully, I explained the problem in a manner that enables you to think about solutions. This is less of a code problem, but more of a unity collider and joints problem. I chose to not add code because it's just too much. Edit Since I'm using an evolutionary algorithm, at each point in time, there is more than one creature. A regular evolution process is slow, but when a creature breaks the physics, it gains a big lead. Deleting creatures like that helped slow down the takeover of cheating creatures, but did not prevent it. Many thanks. |
0 | GameObject scope over RPC call Debugging my code I faced some unexpected behavior. I called an RPC using uLink.NetworkView on the server passing some parameter including a GameObject tagged as Player. Inside that RPC I make a call to GameObject.FindObjectsWithTag("Player") What I refer to by saying "unexpected" is that that function returns all the gameobjects in hierarchy INCLUDING the gameobject passed as parameter to the RPC call. I noticed that inside the editor it appears in hierarchy the gameobject passed to the RPC but without all the components BUT the transform. My question is to know exactly how the scope is working, I seem to understand that the scope of the FindObjectsWithTags seems to include RPC parameters but without the most informations. Any clue about this? |
0 | Unity3D Resize texture without corruption I am currently working on a solution to make my game look very pixelated, like Doom or Quake. But there is a big problem. I'm using Unity Personal. I render my camera to a 1920x1080 texture, then I try to use Texture2D.Resize on it, then render it back to the screen using ScaleMode.StretchToFill. But the problem is that the texture seems to corrupt when I use Texture2D.Resize on it. And here is my current code using UnityEngine using System.Collections public class PixelRenderer MonoBehaviour Texture2D texture Use this for initialization void Start () texture new Texture2D(256, 256, TextureFormat.ARGB32, false) Update is called once per frame void OnPostRender() texture new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false) texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0) texture.Apply() texture.Resize(256, 256) void OnGUI() GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), texture, ScaleMode.StretchToFill) Is there something that I'm missing here? Or am I doing something wrong? |
0 | How do I make my camera follow my cube? I've recently started to learn some C scripting in Unity. I've been able to make my PlayerCube move around using Vector3 Transform.translations, but I want my camera to follow my cube while moving around, and it's not working since Unity can't find PlayerCube. How do I make make it so it understands that there's a PlayerCube? using UnityEngine using System.Collections public class CameraScript MonoBehaviour Player GameObject.Find("PlayerCube") Use this for initialization void Start () GameObject.Find(PlayerCube) Update is called once per frame void Update () Transform.LookAt (PlayerCube) |
0 | Refresh UI after changing source code I was trying following things. GameManager bool gameHasEnded false public GameObject completeLevelUI public void CompleteLevel() completeLevelUI.SetActive(true) public void EndGame() if(gameHasEnded false) gameHasEnded true Invoke( quot Restart quot ,2f) void Restart() SceneManager.LoadScene(SceneManager.GetActiveScene().name) EndTrigger public GameManager gameManager void OnTriggerEnter() gameManager.CompleteLevel() I get a log in the console quot END quot . Earlier I was using Console.Log( quot END quot ) on CompleteLevel(), but I changed that source code. The old code seems to be working and not the new one. It's like Unity couldn't refresh that source code. (And I am sure that I have successfully saved the C file.) using System.Collections using System.Collections.Generic using UnityEngine public class PlayerCollision MonoBehaviour public PlayerMovement movement void OnCollisionEnter(Collision collisionInfo) Debug.Log(collisionInfo.collider.name) if (collisionInfo.collider.tag quot obstacle quot ) movement.enabled false FindObjectOfType lt GameManager gt ().EndGame() |
0 | Best practice for implementing overall weekly daily highscores? So I'm setting up social leaderboards and I want there to be daily weekly overall high scores. The way the scoring works is each score is tied to a user after the user logs in so the scores need to always be linked to a user. I'm using the Parse BaaS with Unity C and I've gotten overall highscores working by adding a highScore field to the ParseUser model. From the research that I've done so far based on google play services and game center has led me to the following solution. Have 3 fields for the ParseUser model overallScore, dailyScore, weeklyScore. Reset dailyScore and weeklyScore when appropriate Is this an appropriate solution for what I'm trying to implement? Is there a more efficient or scalable way to do it? |
0 | How to use Resources.Load with an AudioClip in Unity? I'm trying to load an audio clip that's in my assets directory and play it. Here is my C script if (Input.GetKeyDown(KeyCode.X)) audioSource gameObject.GetComponent lt AudioSource gt () Debug.Log((audioSource null) ? "Audio source is null" "Audio Source is not null") string path "Sounds Aurora Aurora IGSSin" Debug.Log(path) sound (AudioClip)Resources.Load(path, typeof(AudioClip)) Debug.Log((sound null) ? "Sound is null" "Sound is not null") Output Audio source is not null Sounds Aurora Aurora IGSSin Sound is null There is an AudioSource component attached to this object, as proved by the first Debug.Log(). Attached is a picture of my folder, proving that the file path is correct. I've seen 90 different posts and tried this 81 different ways, including using the file extension in the path, omitting the directory and only including the file name, omitting (AudioClip) before Resources.Load(), using as AudioClip rather than typeof(AudioClip) and none of it has worked. Please, someone help me before I pull my hair out over this. I'm incredibly flustered over being stuck on something that should be so simple, and I'd like to get on with my project. My Project Directory |
0 | How to make camera smooth when following player When my character moves through my cameras 'FollowPlayer' script, the background just looks really glitchy and bad Is there anyway to fix this? This is my script using UnityEngine using System.Collections public class FollowPlayer MonoBehaviour Transform bar void Start() bar GameObject.Find("PlayerMovingBar").transform void Update() transform.position new Vector3( bar.position.x, transform.position.y, transform.position.z) |
0 | How do I get the size of a Plane in pixels and set it multiplied by some factor to be the size of a Sphere? I am doing an attempt to make a 3D snake game, as an experiment but I am still a beginner. I have a Sphere that I wish to dynamically resize to be, let's say, the 20th part of the width of this Plane. How can I do this? I thought to find the size of the Plane first. I also thought to use Screen.width and Screen.height because in my actual project the Plane is almost the size of the screen, but from what I found the Transform class does not have a way to resize it to a specific dimension in pixels. Using the code below I do not get this work, but I also see that the Sphere becomes a black circle because of the only instruction in the Start method. Existing code using System.Collections using System.Collections.Generic using UnityEngine Attached to the Plane public class SphereResizer MonoBehaviour Start is called before the first frame update void Start() what should I put here? GameObject.Find("Sphere").transform.localScale new Vector3(1f, 1f) Update is called once per frame void Update() Screenshots Download the example Here is the GitHub repository. Thank you. |
0 | How to properly copy paste object between folder? I'm new to unity and found some simple task can't be done here. For example in projects tab, i want to copy paste a script from script folder to other folder. I should be able to simply select the script, press ctrl C , go to target folder , press ctrl V to paste but nothing happen. So for now , i have to duplicate it then move it to new folder then rename it. But why can't i do simply copy and paste ? |
0 | Spotlights and Pointlights not working with Unity Render Pipeline? I'm experimenting with URP, Render Pipelines, and Shaders for the first time recently and have noticed something odd. In the scene I'm building, Point Lights and Spotlights don't work. No matter what I do, they do not affect the environment at all, for static and nonstatic objects. I can't even use a Halo component to visualize them. They exist in the scene but don't do anything and even Lightmaps don't seem to register them. I suspect that it's because of the render pipeline, but if I go to a blank scene and put a spotlight on an object, it works. I'm just very confused what's happening. Any idea what might be happening? |
0 | Attach component of other Object to a variable within Unity Inspector This question might sound a bit stupid and I'm sure there is a simple solution for this .. I'm just not finding it Actually all I want to do is attach the MeshRenderer Component of this Object to a variable of a script on another Object like Problem As soon as you click on the Capsule Object ofcourse the Inspector changes to this Object and I cannot drag in a component to the previous selected Object anymore. I know there are a lot alternatives like linkin only the GameObject e.g. as MeshObject and later in code refer to MeshObject.GetComponent lt MeshRenderer gt but I wondered if this can be done directly, too. |
0 | Drawing an arrow using the LineRenderer in unity I'm trying to draw an arrow using a LineRenderer in Unity, using the code suggested here. Based on the UI it all seems good, yet it draws a pin needle, rather than the arrow I would expect from the UI. If I understand the UI right, it should thicken 60 into the line and then become thinner again towards the end. Any idea what might be going wrong? |
0 | NullReferenceException in Unity Since many users are facing the NullReferenceException Object reference not set to an instance of an object error in Unity, I thought that it would be a good idea to gather from multiple source some explanation and ways to fix this error. Symptoms I am getting the error below appearing in my console, what does it mean and how do I fix it? NullReferenceException Object reference not set to an instance of an object |
0 | Play and Stop Animation on Condition Unity I've applied a scale animation on Play button of my game. I want to stop animation when play button is not interactable. It stops playing animation, but animation is not playing again, even when play button gets interactable. Here is my snippet to Play and Stop Animation. if (!PlayButton.GetComponent lt Button gt ().IsInteractable()) PlayButtonAnimator.Stop () else if (PlayButton.GetComponent lt Button gt ().IsInteractable()) PlayButtonAnimator.Play ("Play Button Animation") What should i do to play animation again. Thanks in advance ) |
0 | How to play character animation when using A pathfinding Hi I am trying to make racing game. In which I am using mecanim animation system to animate my character. Here are the conditions for the animation to play Speed gt 1 Run Speed gt 0 0.5 walk Speed gt lt 0.10 walk back if I set the speed to 1, my character will run i.e anim.setFloat("Speed",1) will run my character. As it is a racegame I need to move the other characters from source to destination. For which I am using A Pathfinding project of arongberg. using the above algorithm I am getting the path and I am using simpleMove of character control to move the character. Now the problems comes here 1.As the character needs to play run animation while moving, which is not happening, if I set anim.setFloat("Speed",1) it is not moving in the direction of path instead it is moving on its own direction I have tried to apply run animation directly instead of animation controller, but the same Happening. if I remove all the animation character reaching to destination without any animation. Here is the question where I have posted the code, I am asking the same question again but I was stuck with from past4 days. http answers.unity3d.com questions 495397 how to make my character move in the direction of.html |
0 | Having player names over models in 3d space I wanted to have in my multiplayer game, the players name's over their models, however I am faced with the question of how? Should I create a new Canvas object for each game model or just use 1 main canvas and move their names around relative to position in 3D world space? My aim is to have an open world game. |
0 | Object pooling of different tpyes of agents (Mobile Game) in Unity The mobile game I am developing consists of one to four players and different agents that are being spawned and act in their own way. All those Agents (Car, Animal and Powerup) derive from the same base class 'Agent' which in turn has a field called 'rank' which represents something like 'low', 'medium' and 'high'. So an agent with rank 'high' will look and behave different than one being tagged 'low'. The thing is the 'rank' of the agent is determined at random. The max count of agents active simultaneously is known but this number is not in regard to their 'rank'. When objectpooling, this would lead to the follwing case There's a max agent count of, say, 6. This would require 6 instances of each agent with rank 'low' to 'high' to be created, altough some of those instances would never even be used. So my idea was to create only 6 gameobjects holding the components that each agent requires and use reflection to set the components fields according to the type. The problem is that some compoents which are unique to rank and type would need to be added and removed at runtime. What solution would be better in terms of runtime and memory performance? |
0 | Additive "Sprites Default" shader The Sprites Default shader multiplies the color with the provided tint, while I need to add it instead. I fixed this copying the shader (taken from here) and simply changing the line return tex2D( MainTex, IN.texcoord) IN.color to return tex2D( MainTex, IN.texcoord) IN.color Is this the right approach, or there was a better one? (which uses something like inheritance, as opposite to copy pasting) Also, is this legal? I assume they allow you to use it at will, but technically there's no licence attached to the shader, so I'm not sure. Maybe that's covered somewhere in the Unity license? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.