Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Stick100
Mar 18, 2003

HauntedRobot posted:

I've finally decided to get into Unity, and I've been watching a ton of tutorials and I just want a bit of a sanity check here. I'm kind of blown away by what you can do with it, all the systems it gives you for basically free, it's very inspiring. But I look at the kinds of games I'm planning on making with it, stuff like roguelikes, 3d puzzles and whatnot and things with a lot of procedural generation and it looks as though I'm going to be generating a lot of my stuff from code, still. Rather than you know, pull an asset from the asset store, position it in a level, give it a rigidbody and throw physics at it, the whole "grab a bunch of premade stuff and combine it to make a game" model it seems to be funneling me towards.

Is that a crazy way to use Unity? Just as basically an event handling, render pipeline setup, ui overlaying front end on something that's very driven by hand-carved procedural generation code? Should I try harder to get into that mindset of leaning heavier on it or just go with what my instincts are telling me here, cos I'm very much a coder at heart, just not one that can be hosed to troubleshoot making an engine from scratch in TYOOL 2019.

No, that's a very good way to use Unity. Recreating input and rendering is a huge burden that's good to off load by using Unity. If you want a look at Unity/proc-gen look up the talk about Dungeon of the Endless and the talk about the top-down rouge-like spaceship game with 80's cartoon aesthetic that I can't remember the name of.

They are quite old but the planning/techniques still work.

Adbot
ADBOT LOVES YOU

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Stick100 posted:

If you want a look at Unity/proc-gen look up the talk about Dungeon of the Endless and the talk about the top-down rouge-like spaceship game with 80's cartoon aesthetic that I can't remember the name of.

I want to know more about this, because the only top-down spaceship roguelikes I know of are FTL and Transcendence and I don't think either of them quite fits your description.

My own game, in Unity, isn't procgen but is heavily data-driven -- I'm reading mission files and then spawning in assets based on those files, instead of having scenes populated with GameObjects that I load. It works fine, and it's not much of a stretch to imagine replacing the files with an algorithm.

HauntedRobot
Jun 22, 2002

an excellent mod
a simple map to my heart
now give me tilt shift
That's great advice, thanks everyone :) I still don't regret wasting the time I spent trying to write my own engine, it was good learning but I realised if I kept doing that I'd be tinkering forever and I want to actually release something one day, maybe.

Stick100
Mar 18, 2003

TooMuchAbstraction posted:

I want to know more about this, because the only top-down spaceship roguelikes I know of are FTL and Transcendence and I don't think either of them quite fits your description.

Galak-Z. I had to look through my steam library to find it. They did Unite talk about the proc gen and did a thing similar to Dungeon of the Endless that had a bunch of set pieces then the proc gen would using rules and match them up to build a cohesive level.

Stick100
Mar 18, 2003

HauntedRobot posted:

That's great advice, thanks everyone :) I still don't regret wasting the time I spent trying to write my own engine, it was good learning but I realised if I kept doing that I'd be tinkering forever and I want to actually release something one day, maybe.

There are times writing your own engine makes sense, but for most project it's overkill when you can use an engine only for the stuff you don't want to handle.

Unity/UE/Monogame (Or it's follow up)/GoDot can have almost everything swapped out of them nowadays.

If you want to see a humorous but serious project look up Futile for Unity. The guy has basically overridden everything EXCEPT Unity's rendering.

EDIT: Wow Futile was last really updated in 2013, apparently it still works in modern Unity if you update a few calls.

Stick100 fucked around with this message at 02:01 on Nov 12, 2019

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Stick100 posted:

Galak-Z. I had to look through my steam library to find it. They did Unite talk about the proc gen and did a thing similar to Dungeon of the Endless that had a bunch of set pieces then the proc gen would using rules and match them up to build a cohesive level.

Ahh, thanks. I played that some awhile back, but don't remember much about it beyond a vague feeling of annoyance. Oh well.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

xgalaxy posted:

Every bad thing I’ve heard about Terraria source code is based on the decompiled source code leak. Decompiling source code has a tendency to greatly alter the original and I’m reluctant to say "lol that programmer was bad" based on it.

Terraria's written in C# - C# dlls may as well be a zip file with the source code if you decompile them unless you use an obfuscator.

xgalaxy
Jan 27, 2004
i write code

Bruegels Fuckbooks posted:

Terraria's written in C# - C# dlls may as well be a zip file with the source code if you decompile them unless you use an obfuscator.

That’s not really true at all. But I don’t feel like wasting my time explaining.

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

xgalaxy posted:

That’s not really true at all. But I don’t feel like wasting my time explaining.
Yeah. Very short explanation, "there is an optimizer". You can't have that and have reverse-compiling be lossless.

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.
Plus any reasonable compiler should be using an obfuscator built-in?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Zaphod42 posted:

Plus any reasonable compiler should be using an obfuscator built-in?

what?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
we have very different definitions of "reasonable", my friend

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

For high level languages like C#? Dotfuscator Community Edition comes free built in with visual studio.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
Quoting myself in the thread for people who have probably seen whatever I hosed up here a million times. The context is I'm making a basic ray caster in Java as an intermediate step to doing a joke doom source port but I have a poetry degree and all this trig and linear algebra gives me the vapors.

jit bull transpile posted:

ok what am i loving up in my attempt to implement mouselook? i'm using awt so there's no relative motion tracking of the mouse. i'm faking it by calculating the distance moved from mouse-center and then resetting the mouse to center each time mouesmoved is called. rotating to the right works just fine, but rotating to the left just rotates to the right really fast. I think I'm misunderstanding how the 2d rotation matrix works but all this linear algebra poo poo is kinda over my head:

Java code:
	@Override
	public void mouseMoved(MouseEvent e) {
		if (this.isRecentering && this.centerLocation.x == e.getX()
				&& this.centerLocation.y == e.getY()) {
			this.isRecentering = false;
		}
		else {
			 int dx = e.getX() - this.mouseLocation.x;
			 double rot = this.ROTATION_SPEED * dx; //rotation speed is a constant of .045
			 if (dx < 0) {//left turn
				double oldxDir=this.xDir;
				this.xDir=this.xDir*Math.cos(rot) - this.yDir*Math.sin(rot);
				this.yDir=oldxDir*Math.sin(rot) + this.yDir*Math.cos(rot);
				double oldxPlane = this.xPlane;
				this.xPlane=this.xPlane*Math.cos(rot) - this.yPlane*Math.sin(rot);
				this.yPlane=oldxPlane*Math.sin(rot) + this.yPlane*Math.cos(rot);
					
			 }
			 else if (dx > 0) { // right turn
				double oldxDir=this.xDir;
				this.xDir=this.xDir*Math.cos(-(rot)) - this.yDir*Math.sin(-(rot));
				this.yDir=oldxDir*Math.sin(-(rot)) + this.yDir*Math.cos(-(rot));
				double oldxPlane = this.xPlane;
				this.xPlane=this.xPlane*Math.cos(-(rot)) - this.yPlane*Math.sin(-(rot));
				this.yPlane=oldxPlane*Math.sin(-(rot)) + this.yPlane*Math.cos(-(rot));
			 }
				 
			 // recenter the mouse
			 if (relativeMouseMode) {
				 recenterMouse();
			 }
		 }
		 mouseLocation.x = e.getX();
		 mouseLocation.y = e.getY();
	}
if i flip the greater than and less thans i get the opposite problem (only rotating left) but my brain is just not quite getting to taking this observation to a genuine intutition. my next guess was to just only always use the first version of the matrix and not use the second but that just makes the screen wiggle uncontrollably when i mouse.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
So first off, your goal is to apply a rotation of rot radians to these varaiables. That means you want the first form of the matrix always, and we shouldn't need any extra conditions. rot can be positive or negative and it should work out fine.

You mentioned that it goes very unstable when you do that though.

To help debug one thing at a time, try hardcoding different values for dx instead. You should be able to set it to 1, 2, 3, 4, -1, -2, -3, -4 with relative confidence. That will let you know if the mouse delta is the issue or not.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Suspicious Dish posted:

So first off, your goal is to apply a rotation of rot radians to these varaiables. That means you want the first form of the matrix always, and we shouldn't need any extra conditions. rot can be positive or negative and it should work out fine.

You mentioned that it goes very unstable when you do that though.

To help debug one thing at a time, try hardcoding different values for dx instead. You should be able to set it to 1, 2, 3, 4, -1, -2, -3, -4 with relative confidence. That will let you know if the mouse delta is the issue or not.

so doing this, i can occasionally make it rotate clockwise with the mouse but it will sometimes go bouncy, and it always goes bouncing trying to rotate to the left. This happens even if I just set rot to TURN_SPEED * +-1 so I think there's something screwy about how Java's mouse behaves or the recentering technique is interfering in an unexpected way, as the turn speed is not an issue when I use left and right arrow keys as my rotate input.

I think my best bet is to look at the source for one of the java doom source ports and see how they achieve mouselook. in the mean time i'll distract myself with adding keys and doors.

edit: i confirmed my suspicion by logging the value of dx and rot to the console and then making a continuous mouse motion leftward over my screen. the value bounces between positive and negative over and over. i thought the obvious solution was to turn the else statement into else if (!this.isRecentering) but this causes the mouse never to recenter for some reason. I wonder if multiple mouse events are being fired simultaneously and contending for the values that are tracking the previous mouse position and whether we're recentering.

The MUMPSorceress fucked around with this message at 07:37 on Nov 16, 2019

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Again, we don't have your whole code. We don't even know where this.isRecentering is set to true. But you should indeed ignore any inputs while you think you're recentering the mouse.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Suspicious Dish posted:

Again, we don't have your whole code. We don't even know where this.isRecentering is set to true. But you should indeed ignore any inputs while you think you're recentering the mouse.

I'll post the rest of the code when I'm at my computer next.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
Alright, here's the full code of my camera class. Bear in mind his is cobbled together from a few tutorials with some refactoring from me because I'm doing this as a learning exercise.

Java code:
package self.jitbull.practice.game;

import java.awt.AWTException;
import java.awt.Point;
import java.awt.Robot;
import java.awt.Window;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;

import javax.swing.SwingUtilities;

import self.jitbull.practice.game.data.GameMap;
import self.jitbull.practice.game.data.GameMap.WallType;

public class Camera implements KeyListener, MouseMotionListener{
	private double xPos, yPos, xDir, yDir, xPlane, yPlane;
	private boolean left, right, forward, back, strafeLeft, strafeRight;
	private final double MOVE_SPEED = .08;
	private final double ROTATION_SPEED = .045;
	 private Robot robot;
	 private Point mouseLocation;
	 private Point centerLocation;
	 private  boolean isRecentering = false;
	 private Window window = null;
	
	public Camera(double x, double y, double xd, double yd, double xp, double yp) 
	{	
		this.xPos = x;
		this.yPos = y;
		this.xDir = xd;
		this.yDir = yd;
		this.xPlane = xp;
		this.yPlane = yp;
		this.mouseLocation = new Point();
		this.centerLocation = new Point();
		try {
			this.robot = new Robot();
		} catch (AWTException e) {
			e.printStackTrace();
		}
	}	
	
	public void setWindow(Window window) {
		this.window = window;
	}
	
	@Override
	public void keyTyped(KeyEvent e) {

	}

	@Override
	public void keyPressed(KeyEvent e) {
		switch (e.getKeyCode()) {
		case KeyEvent.VK_LEFT: this.left = true; 
		break;
		case KeyEvent.VK_RIGHT: this.right = true;
		break;
		case KeyEvent.VK_W: this.forward = true; 
		break;
		case KeyEvent.VK_S: this.back = true; 
		break;
		case KeyEvent.VK_A: this.strafeLeft = true;
		break;
		case KeyEvent.VK_D: this.strafeRight = true;
		break;
		}
	}

	@Override
	public void keyReleased(KeyEvent e) {
		switch (e.getKeyCode()) {
		case KeyEvent.VK_LEFT: this.left = false; 
		break;
		case KeyEvent.VK_RIGHT: this.right = false;
		break;
		case KeyEvent.VK_W: this.forward = false; 
		break;
		case KeyEvent.VK_S: this.back = false; 
		break;
		case KeyEvent.VK_A: this.strafeLeft = false;
		break;
		case KeyEvent.VK_D: this.strafeRight = false;
		break;
		}
	}
	
	public void update(GameMap map) {
		if(this.forward) {
			if(map.getWallAtCoords((int)(this.xPos + this.xDir * this.MOVE_SPEED),(int)this.yPos) == WallType.NONE) {
				this.xPos+=this.xDir*MOVE_SPEED;
			}
			if(map.getWallAtCoords((int)this.xPos,(int)(this.yPos + this.yDir * this.MOVE_SPEED)) == WallType.NONE) {
				this.yPos+=this.yDir*this.MOVE_SPEED;
			}
		}
		if(this.back) {
			if(map.getWallAtCoords((int)(this.xPos - this.xDir * this.MOVE_SPEED),(int)this.yPos) == WallType.NONE) {
				this.xPos-=this.xDir*this.MOVE_SPEED;
			}
			if(map.getWallAtCoords((int)this.xPos,(int)(this.yPos - this.yDir * this.MOVE_SPEED)) == WallType.NONE) {
				this.yPos-=this.yDir*this.MOVE_SPEED;
			}
		}
		if (this.strafeRight) {
			if(map.getWallAtCoords((int)(this.xPos + this.xPlane * this.MOVE_SPEED),(int)this.yPos) == WallType.NONE) {
				this.xPos+=this.xPlane*this.MOVE_SPEED;
			}
			if(map.getWallAtCoords((int)this.xPos,(int)(this.yPos + this.yPlane * this.MOVE_SPEED)) == WallType.NONE) {
				this.yPos+=this.yPlane*this.MOVE_SPEED;
			}
		}
		if(this.right) {
			double oldxDir=this.xDir;
			this.xDir=this.xDir*Math.cos(-this.ROTATION_SPEED) - this.yDir*Math.sin(-this.ROTATION_SPEED);
			this.yDir=oldxDir*Math.sin(-this.ROTATION_SPEED) + this.yDir*Math.cos(-this.ROTATION_SPEED);
			double oldxPlane = this.xPlane;
			this.xPlane=this.xPlane*Math.cos(-this.ROTATION_SPEED) - this.yPlane*Math.sin(-this.ROTATION_SPEED);
			this.yPlane=oldxPlane*Math.sin(-this.ROTATION_SPEED) + this.yPlane*Math.cos(-this.ROTATION_SPEED);
			
		}
		if (this.strafeLeft) {
			if(map.getWallAtCoords((int)(this.xPos - this.xPlane * this.MOVE_SPEED),(int)this.yPos) == WallType.NONE) {
				xPos-=xPlane*MOVE_SPEED;
			}
			if(map.getWallAtCoords((int)this.xPos,(int)(this.yPos - this.yPlane * this.MOVE_SPEED)) == WallType.NONE) {
				this.yPos-=this.yPlane*this.MOVE_SPEED;
			}
		}
		if(this.left) {
			double oldxDir=this.xDir;
			this.xDir=this.xDir*Math.cos(this.ROTATION_SPEED) - this.yDir*Math.sin(this.ROTATION_SPEED);
			this.yDir=oldxDir*Math.sin(this.ROTATION_SPEED) + this.yDir*Math.cos(this.ROTATION_SPEED);
			double oldxPlane = this.xPlane;
			this.xPlane=this.xPlane*Math.cos(this.ROTATION_SPEED) - this.yPlane*Math.sin(this.ROTATION_SPEED);
			this.yPlane=oldxPlane*Math.sin(this.ROTATION_SPEED) + this.yPlane*Math.cos(this.ROTATION_SPEED);
			
		}
	}
	
	private synchronized void recenterMouse() {
		if (robot != null && window.isShowing()) {
			this.centerLocation.x = this.window.getWidth() / 2;
			this.centerLocation.y = this.window.getHeight() / 2;
			SwingUtilities.convertPointToScreen(this.centerLocation, this.window);
			this.isRecentering = true;
			robot.mouseMove(this.centerLocation.x, this.centerLocation.y);
		}
	}
	
	@Override
	public synchronized void mouseDragged(MouseEvent e) {
		this.mouseMoved(e);
	}
	
	@Override
	public synchronized void mouseMoved(MouseEvent e) {
		if (this.isRecentering && this.centerLocation.x == e.getX()
				&& this.centerLocation.y == e.getY()) {
			this.isRecentering = false;
		}
		else {
			 int dx = e.getX() - this.mouseLocation.x;
			 double rot = this.ROTATION_SPEED * dx;
			 System.out.println(String.format("dx: %d   rot: %f", dx, rot));
			 double oldxDir=this.xDir;
			 this.xDir=this.xDir*Math.cos(rot) - this.yDir*Math.sin(rot);
			 this.yDir=oldxDir*Math.sin(rot) + this.yDir*Math.cos(rot);
			 double oldxPlane = this.xPlane;
			 this.xPlane=this.xPlane*Math.cos(rot) - this.yPlane*Math.sin(rot);
			 this.yPlane=oldxPlane*Math.sin(rot) + this.yPlane*Math.cos(rot);

			 recenterMouse();
		 }
		 mouseLocation.x = e.getX();
		 mouseLocation.y = e.getY();
	}
	
	
	public double getxDir() {
		return xDir;
	}
	public double getyDir() {
		return yDir;
	}
	public double getxPlane() {
		return xPlane;
	}
	public double getyPlane() {
		return yPlane;
	}
	public double getxPos() {
		return xPos;
	}
	public double getyPos() {
		return yPos;
	}
	public double getROTATION_SPEED() {
		return ROTATION_SPEED;
	}

}

baby puzzle
Jun 3, 2011

I'll Sequence your Storm.
After the last time I updated Visual Studio, players started getting errors about missing VCRUNTIME140_1.dll

I assume the checkbox in Steam under installation->redistributables called "Visual C++ Redist 2019" supposed to fix that? I hope??

Edit actually it probably has to do with switching to C++17, not the Visual Studio upgrade.

e: ok they tell me it works now.

baby puzzle fucked around with this message at 17:05 on Nov 19, 2019

PnP Bios
Oct 24, 2005
optional; no images are allowed, only text
I've gotten into writing DOS games for some dumb reason. Does anybody know how to check for multiple key presses at once? I have been dicking around with `int 16h` and it seems pretty responsive, but only reads in one key at a time. Also it does a stupid repeat thing. If anybody has found a good way to just scan keys, that would be neat.

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
You'll need to write your own keyboard handler iirc. Found some old stuff here.

PnP Bios
Oct 24, 2005
optional; no images are allowed, only text

Sagacity posted:

You'll need to write your own keyboard handler iirc. Found some old stuff here.

Thanks!

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
What's the recommended thing for audio out on Windows now (assuming I just need basic stereo out and not mixing/position/DSP/any other fancy stuff), XAudio2 or Core Audio?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
xaudio2 is fine

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Is any of the Cyber Week Sale stuff in the Unity Asset Store worth it? It looks like DOTween Pro is on sale 50% off.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
Odin Inspector is worth picking up if you don't already have it.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

TooMuchAbstraction posted:

Odin Inspector is worth picking up if you don't already have it.

I got that already and will second that. I didn't see it was listed.

Any opinions on anime toon shaders?

KillHour
Oct 28, 2007


Rocko Bonaparte posted:

I got that already and will second that. I didn't see it was listed.

Any opinions on anime toon shaders?

Are you making a hentaivisual novel game?

TIP
Mar 21, 2006

Your move, creep.



Can anyone point me towards a good resource for learning to work with Unity's UI through scripting? I went through the documentation, but it's pretty lovely, and still points to random deprecated stuff. And it seems like every UI tutorial I can find is about building menus without coding, or contains a bunch of outdated information.

Is UIElements even close to ready for production? I have lots of experience building UIs on web technologies, so it appeals to me, but I was scared off by the warnings.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Tip posted:

Can anyone point me towards a good resource for learning to work with Unity's UI through scripting? I went through the documentation, but it's pretty lovely, and still points to random deprecated stuff. And it seems like every UI tutorial I can find is about building menus without coding, or contains a bunch of outdated information.

Is UIElements even close to ready for production? I have lots of experience building UIs on web technologies, so it appeals to me, but I was scared off by the warnings.

I can't say I found anything particularly good, but I remember getting much better results searching for "dynamic GUI" in particular. That implies having to do some code.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
Is there something in particular you're trying to do? I could maybe answer some questions based on what I've figured out from trial and error. Unity's UI system is bizarro-world compared to most sane layout systems.

TIP
Mar 21, 2006

Your move, creep.



TooMuchAbstraction posted:

Is there something in particular you're trying to do? I could maybe answer some questions based on what I've figured out from trial and error. Unity's UI system is bizarro-world compared to most sane layout systems.

Right now I'm trying to generate text dynamically and animate it up the screen.

But, I'm also going to be building a full game interface and menu, so I figured I should probably find something that covers all the basics and helps me understand the overall system.

I am up for buying something from the asset store if anyone here thinks any of the UI tools are worth it.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Tip posted:

Right now I'm trying to generate text dynamically and animate it up the screen.

But, I'm also going to be building a full game interface and menu, so I figured I should probably find something that covers all the basics and helps me understand the overall system.

I am up for buying something from the asset store if anyone here thinks any of the UI tools are worth it.

I ended up forking out for TextMeshPro--which then got kinda-sorta swallowed into Unity officially--in order to achieve many things I would have considered basic with text. It's possible what you're trying to do with the original new GUI stuff isn't even a thing.

Stick100
Mar 18, 2003

Tip posted:

I am up for buying something from the asset store if anyone here thinks any of the UI tools are worth it.

Use Textmesh pro it's pretty easy/built into Unity now. If you have an extensive web background there are some html/js/css methods of doing UI that might make more sense.

In general you make a text mesh, then expose the text and modify it via scripts.

KillHour
Oct 28, 2007


It also depends on your timelines. Unity is building a new UI system from the ground up, but it won't be in preview for another couple of quarters.

https://forum.unity.com/forums/uielements.178/

I'm just building in a simple development UI framework that abstracts window creation with the existing stuff until that gets released so I can go back and redo it with actually nice-looking stuff.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Isn't this like the fifth ui rewrite they've done

Stick100
Mar 18, 2003

KillHour posted:

It also depends on your timelines. Unity is building a new UI system from the ground up, but it won't be in preview for another couple of quarters.

https://forum.unity.com/forums/uielements.178/

I'm just building in a simple development UI framework that abstracts window creation with the existing stuff until that gets released so I can go back and redo it with actually nice-looking stuff.

Given the recent track record of Unity, I'd suggest only using non-preview features in LTS versions. The items in preview have had some horrendous bugs, the non-LTS builds (not just betas) have had horrendous bugs. 2017 LTS, 2018 LTS have both treated me well recently.

Edit: Use Textmesh, they bought the product and haven't messed it up.

Stick100 fucked around with this message at 19:21 on Dec 11, 2019

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Tip posted:

Right now I'm trying to generate text dynamically and animate it up the screen.

But, I'm also going to be building a full game interface and menu, so I figured I should probably find something that covers all the basics and helps me understand the overall system.

I am up for buying something from the asset store if anyone here thinks any of the UI tools are worth it.

OK, use TextMeshPro for your text. You can write scripts to adjust character transparency on the fly or do things like make it bounce, change color, etc.

For UIs in general, generally it's possible to make Unity's current UI system do what you want, it just may not be very intuitive. Read up on the layout components and how anchors work.

My approach is to make a prefab for the overall thing I want to control (e.g. a dialog box, a radar HUD, etc.), make a script that has public properties for each of the things I want to adjust in code ("a public TMP_Text for the weapon's name, another one for the ammo count, an Image for the border"), stick the script on the prefab, and use the inspector to drag the relevant UI item into each slot in the script. Then I can hand the prefab off to whatever code needs to instantiate it, and it can access the script inside the prefab and tell it what to do. This is of course for instances where I need multiple copies of the prefab; if there's just one then I slap it into the scene directly and enable/disable it as needed. That saves the overhead of creating GameObjects at runtime.

Adbot
ADBOT LOVES YOU

KillHour
Oct 28, 2007


Suspicious Dish posted:

Isn't this like the fifth ui rewrite they've done

Third. IMGUI was the first one. Then the Canvas system. Now it's all CSS and generic web-based stuff.

If you want, you can try it now - https://github.com/Unity-Technologies/UIElementsUniteCPH2019RuntimeDemo

Stick100 posted:

Given the recent track record of Unity, I'd suggest only using non-preview features in LTS versions. The items in preview have had some horrendous bugs, the non-LTS builds (not just betas) have had horrendous bugs. 2017 LTS, 2018 LTS have both treated me well recently.

Every time I've had a bug that halted development, I submitted a report and it was fixed in the next release. I, and a lot of people here, are doing this as a hobby and can wait for poo poo to be fixed, so I always develop on the latest beta and try out the alphas if they have something I think will be useful. If you do this as your actual job. use the LTS stuff with a real support contract. I will say that DOTS has allowed me to work on mechanics that would otherwise literally not be possible, so I deal with it breaking occasionally.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply