[QUOTE=KillaMaaki;45423828]Well, let's do some detective work here.
The line it throws the error on appears to be this one:
[code]
Instantiate(projectile, firePosition.position, transform.rotation);
[/code]
It's a NullReferenceException, so one of these things must be null.
Which one of them could be?
[I]projectile[/I] might be, if it were unassigned in the inspector.
So might [I]firePosition[/I], if transform.Find returned null.
[I]transform[/I] never will be, so we will not consider it.
So, of the two [I]projectile[/I] and [I]firePosition[/I], which is null?
Clearly, it is not [I]projectile[/I], as judging from your screenshot it is, in fact, assigned in the inspector.
Therefore, it must be [I]firePosition[/I] which is null.[/QUOTE]
You were right! Thanks!
[QUOTE=Wowza!;45423706][IMG]http://puu.sh/ag78z/36cdc431bf.png[/IMG]
I have no idea why I keep getting this error. Is anyone able to help?
[CODE]#pragma strict
var speed : float = 1;
var fireRate : float = 0.75;
var projectile : GameObject;
var smooth : float = 1;
var fireForce : float = 2;
private var gameController : GameController;
private var projectiles : GameObject[];
private var firedObject : GameObject;
private var firePosition : Transform;
private var nextFire : float = 0;
function Awake() {
gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent(GameController);
rigidbody2D.centerOfMass = Vector2(0, -1);
firePosition = transform.Find("firePosition");
}
function Update(){
}
function FixedUpdate () {
projectiles = GameObject.FindGameObjectsWithTag("Projectile");
var moveHorizontal = Input.GetAxis("Horizontal");
var forceVector : Vector2;
if (Input.GetButton("Fire1") && Time.time > nextFire) {
nextFire = Time.time + fireRate;
Instantiate(projectile, firePosition.position, transform.rotation);
}
for(var projectile in projectiles){
forceVector += gameController.CalculateForce(projectile, gameObject);
}
rigidbody2D.AddForce(forceVector);
// while(Input.GetButton("Fire1"))
// firedObject.transform.localScale = Vector3.Lerp(Vector3(0.6, 0.6, 1), Vector3(2, 2, 1), smooth * Time.deltaTime);
// if (Input.GetButtonUp("Fire1")) {
// firedObject.rigidbody2D.AddForce(Vector2(-transform.right.x, -transform.right.y) * fireForce);
// }
transform.Rotate(transform.forward * moveHorizontal * speed);
}
[/CODE]
[IMG]http://puu.sh/ag7kR/000dc2e313.png[/IMG][/QUOTE]
Looks like it's either missing a reference to projectile or firePosition. Maybe you didn't find the right object?
[b]Edit:[/b]
Woops, looks like i'm late :v:
Now it's starting to resemble a game...
I made the camera dampen when tracking the player, too, so that it feels a little more, I guess, organic would be the word. Thoughts?
e: Video's acting weird. Here's the URL, seems to work for me.
[url]http://www.youtube.com/watch?v=ATFHzBhf6y8[/url]
[editline]18th July 2014[/editline]
This should be going in WAYWO shouldn't it...
[QUOTE=Protocol7;45427957]Now it's starting to resemble a game...
I made the camera dampen when tracking the player, too, so that it feels a little more, I guess, organic would be the word. Thoughts?
e: Video's acting weird. Here's the URL, seems to work for me.
[URL]http://www.youtube.com/watch?v=ATFHzBhf6y8[/URL]
[editline]18th July 2014[/editline]
This should be going in WAYWO shouldn't it...[/QUOTE]
I really dig that VCR Font for the money earned. That is pretty rad.
The camera still seems a bit sharp to the player position, are you Lerping the camera position to the player position?
[QUOTE=Thlis;45430399]I really dig that VCR Font for the money earned. That is pretty rad.
The camera still seems a bit sharp to the player position, are you Lerping the camera position to the player position?[/QUOTE]
Smoothly damping via SmoothDamp:
[cpp]public Transform target;
public float dampTime= 0.17f;
private Vector3 velocity = Vector3.zero;
private void FixedUpdate()
{
if (target)
{
var point = camera.WorldToViewportPoint(target.position);
var delta = target.position - camera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, point.z));
var destination = transform.position + delta;
transform.position = Vector3.SmoothDamp(transform.position, destination, ref velocity, dampTime);
}
}[/cpp]
If there's a better way to do that, let me know.
I'll be posting game updates in the WAYWO thread from here on out.
Working on a Fire FX pack for Unity.
[video=youtube;SFQaYXjmrL4]http://www.youtube.com/watch?v=SFQaYXjmrL4[/video]
Six effects:
- Regular fire
- Torch
- Character/object on fire
- Big fire
- Wide fire (molotov?)
- Flamethrower
Thoughts?
[QUOTE=KillaMaaki;45432248]Working on a Fire FX pack for Unity.
[video=youtube;SFQaYXjmrL4]http://www.youtube.com/watch?v=SFQaYXjmrL4[/video]
Six effects:
- Regular fire
- Torch
- Character/object on fire
- Big fire
- Wide fire (molotov?)
- Flamethrower
Thoughts?[/QUOTE]
The bigger fires are very noisy for their size, normally flames are much steadier unless the fire is extremely huge and changes surrounding winds or completely depletes oxygen in bubbles of gas.
[QUOTE=KillaMaaki;45432248]Working on a Fire FX pack for Unity.
[video=youtube;SFQaYXjmrL4]http://www.youtube.com/watch?v=SFQaYXjmrL4[/video]
Six effects:
- Regular fire
- Torch
- Character/object on fire
- Big fire
- Wide fire (molotov?)
- Flamethrower
Thoughts?[/QUOTE]
Link to asset store entry please :)
[QUOTE=Luafox;45435896]I like to mess around with particles as well but I'm still new to shuriken so I've had some problems. Do you have any tips on how to get nice effects that look convincing? A workflow example would be cool.[/QUOTE]
Erm..... I dunno. Really, it's a lot of trial and error, figuring out what exactly it is that looks wrong about a particle system and finding the parameters to change it.
In the case of the fire system, I also ended up rendering out fluid sims from Blender for the fire and smoke particles. For the fire system, it's an animated sprite sheet, for the smoke just a single static particle. The fluid sim system can be complicated (and also involves quite a bit of trial and error and just general hair pulling), but the end result is well worth the effort.
And really, there's also lots of Bob Ross-like "happy accidents". For example, that flamethrower effect. The blue bit at the start was originally just a particle system which was used to cover up the origin of the flame (the particles started out small, and at the origin they had quite large gaps between them which looked horrid - so I covered them up with another particle system). And then, on a whim, I made the particle system blue - and it looked great, so I stuck with it.
I also created a custom shader for the fire and sparks, which is nearly identical to the builtin Additive particle save for an HDR Amount slider which multiplies the particle's color by some value between 1 and 20. The particle textures are actually greyscale, but I then give them an orange-ish color and set the HDR Amount fairly high. That makes the fire play quite well with HDR and tonemapping (if you stare directly into the flames, the tonemapping darkens everything to compensate for the brightness of the flames), as well as HDR-friendly bloom packages like Sonic Ether's Natural Bloom.
[QUOTE=garry;45436348]Link to asset store entry please :)[/QUOTE]
Haven't uploaded it yet. Will probably do so today :)
Also got an explosion pack uploaded, and a bullet impact pack on the way.
It is done! Fire FX Pack has been submitted to the asset store.
So, it will be available whenever the hell Unity feels like it ;)
Hopefully I can use these content packs to help fund game development.... fingers crossed.
There was a local game jam where they had to make retro games and it got me thinking about how I know literally nothing about making 2D games so I tried to emulate one with 3D.
It's nothing special, just an experiment to see what I could do with the idea. I basically copied the Touhou layout which, without the new GUI tools, ended up with some hard coded funniness. I could do this better to make the resolution scaleable but that was getting into really tertiary and annoying to deal with problems.
There are two cameras, one for the UI and one for the game world. The window with the game inside it is the game camera, and everything outside is the UI camera. I've only used multiple cameras once before, so that was neat to use again.
For kicks I added a focus button. It doesn't change the shot pattern like it does in Touhou, but it still does the important thing of slowing you down and showing you your hitbox.
I thought about going further and doing the rest of the game stuff but that's all gameplay that wouldn't be too difficult to write. I already accomplished my main goal of mimicking a 2D interface and game window which was the interesting part.
[vid]https://dl.dropboxusercontent.com/u/15133164/UnityGeneral/TopDown%202014-07-19%2014-34-03-42.webm[/vid]
UI for my tool is now pretty much final.
I managed to unify and hide all complicated settings under relatively simple sliders and checkboxes.
And I also added 2 new generator filters that support large gradients (very soft shadows) better than the original implementation.
In the screen you can also see the lightmap picker tool.
What do you guys think?
[IMG] http://i.imgur.com/I43eGbQ.png[/IMG]
[QUOTE=Felheart;45444415]UI for my tool is now pretty much final.
I managed to unify and hide all complicated settings under relatively simple sliders and checkboxes.
And I also added 2 new generator filters that support large gradients (very soft shadows) better than the original implementation.
In the screen you can also see the lightmap picker tool.
What do you guys think?
[IMG] http://i.imgur.com/I43eGbQ.png[/IMG][/QUOTE]
Hello, will be this script for free :P? I have one, but it is dumb 3d grid placement.. that is.
[QUOTE=Fourier;45445020]Hello, will be this script for free :P? I have one, but it is dumb 3d grid placement.. that is.[/QUOTE]
I think maybe I'll give it to every facepuncher for free when its on the asset store!
But I don't think I'll make it free for everyone. It was a lot of work to get it to work so well and we've all got to eat don't we :)
I just recently started using WWW class since I need it for my game.
I just tried to display an image and change when a bool is true.
I used update because I thought it would update it but it didn't.
Can someone help me figure that out. When test is true display that and if I change rest to true while in game change the image again.
Right now it doesn't change it.
[code]
public class WWWClass : MonoBehaviour
{
public string url = "";
public bool test= false;
public bool rest= true;
void Awake()
{
if (test== true)
url = "http://www.aristoteliansociety.org.uk/proceedings/mp3/as-logo-1200.jpg";
if (rest== true)
url = "http://www.arts.uci.edu/sites/default/files/as-you-like-it-shakespeare-center.jpg";
}
void Start()
{
StartCoroutine(MyRoutine());
}
void Update()
{
if (test== true)
{
url = "http://www.aristoteliansociety.org.uk/proceedings/mp3/as-logo-1200.jpg";
transform.localScale = new Vector3(3, 3, 1);
rest= false;
}
if(rest== true)
{
url = "http://www.arts.uci.edu/sites/default/files/as-you-like-it-shakespeare-center.jpg";
transform.localScale = new Vector3(3, 4, 1);
test= false;
}
}
IEnumerator MyRoutine()
{
WWW www = new WWW(url);
yield return www;
renderer.material.mainTexture = www.texture;
}
}
[/code]
When you construct a WWW object, it starts the download for whatever URL you pass [B]upon construction[/B].
You can't just then change a string somewhere and expect it to automagically update. It doesn't work that way. Even IF they still had a reference to your string and were using that (doubtful, on account of the native <-> mono layer), strings are immutable so therefore assigning a new URL makes it a completely NEW string, rather than replacing the existing string in-memory.
The correct way to do it is to start that download coroutine every time you want to change the URL.
One quick question. How would you do that?
Would that be StartCoroutine and .... I've got nothing else.
Nevermind I just went for displaying information from database.
[editline]20th July 2014[/editline]
Using a wiki page and it's working perfectly with a few adjustments I will be able to make it work properly for my game.
I'm making a console command line thing but the textfield is swallowing Enter keycode inputs.
-If the textfield is focused, Input.GetKeyDown() is swallowed and doesn't work.
-If I use Event.current.keycode in OnGUI(), it behaves like Input.GetKey() (fires continuously), and I think it also fires twice which is is bad for how I'm using it.
how can I make it fire once per frame, only when Enter is pushed down?
[code]
if( Event.current.type == EventType.KeyDown && Event.current.keycode == KeyCode.Return )
// do stuff
[/code]
[editline]20th July 2014[/editline]
Sigh. Damn you, Garry Newman. Damn you and your budget for hiring talented artists, the kind which are so close, yet so far, outside of my reach....
;-;
Have been 2d toolkit in discount ever? I'm still waiting since...~2 months and i can't catch it!
[QUOTE=KillaMaaki;45449004][code]
if( Event.current.type == EventType.KeyDown && Event.current.keycode == KeyCode.Return )
// do stuff
[/code][/QUOTE]
That calls continuously if I hold down Enter and the textfield still eats it.
Wow, this is so useful: [url]http://docs.unity3d.com/Manual/StyledText.html[/url]
No more fucking around with GUIStyles just for a different font size/bold/etc.
I need help with Unity and GitHub.
I already have the project set up correctly, with the visible meta files and force text asset serialization. My gitignore is Git's default Unity gitignore. Everything was working swell, except it seems to be fucking up my animations.
Here's what they look like after a fresh Git:
[media]http://www.youtube.com/watch?v=jkecNG9BxeM[/media]
The slices of the sprite are still correct - the animations have incorrect keyframes. Why would Git break this but nothing else?
[editline]21st July 2014[/editline]
Did some deeper digging and apparently Unity does not text serialize animation controllers correctly, and this bug existed since 4.1 at the earliest. Good work, Unity.
Does anyone know how to draw the mesh preview's that are present when you are looking at mesh assets in an editor window GUI?
I mean this:
[img]https://dl.dropboxusercontent.com/u/3715122/ShareX/2014/07/2014-07-21_16-04-58.png[/img]
[img]https://dl.dropboxusercontent.com/u/3715122/ShareX/2014/07/2014-07-21_16-05-07.png[/img]
Or this. Been looking in EditorGUI can't seem to find anything.
Of course you always find it just after asking...
[url]http://docs.unity3d.com/ScriptReference/AssetPreview.html[/url]
If anyone is interested.
Level editor properties:
-properties can be locked
-can edit properties via a properties window
[video=youtube;tM5172cC27c]http://www.youtube.com/watch?v=tM5172cC27c[/video]
[QUOTE=gonzalolog;45449771]Have been 2d toolkit in discount ever? I'm still waiting since...~2 months and i can't catch it![/QUOTE]
Just get free NGUI.. :) it is at 2.7.
I think he is talking about [URL="http://www.unikronsoftware.com/2dtoolkit/"]this[/URL] 2d toolkit.
Another effect pack I'm working on. This one's blood splashes >:)
[video=youtube;5E1PgNvUJ40]http://www.youtube.com/watch?v=5E1PgNvUJ40[/video]
The cloudy ones are mostly inspired by Half Life 2, whereas the splashy ones are inspired by Left 4 Dead and Team Fortress 2.
Though it isn't much to report, I feel like showing off a picture.
[img_thumb]https://dl.dropboxusercontent.com/u/107588088/cave.png[/img_thumb]
Quick underground test with some hacky godrays because apparently the simple way is exclusive to Pro people.
Sorry, you need to Log In to post a reply to this thread.