# Need Unity Help.. (this is probably posted in the wrong place)



## Mr.ButtButt (Sep 9, 2016)

If there's anyone out there that is skilled in Unity, I request your assistance. I'm having a couple problems with getting the game to run after following a tutorial online up until a specific point, and I''m getting errors when I go to test it. 
Thanks in advance..


----------



## Deleted User (Sep 9, 2016)

I'm pretty skilled. What sort of errors are you encountering?


----------



## Mr.ButtButt (Sep 9, 2016)

Voxel said:


> I'm pretty skilled. What sort of errors are you encountering?


baaaaabe <3333
uuuuh lemme see.
I'm following this tutorial: 

And i got to the end where he imports the Standard Unity Assets for the Characters.

he doesn't get any error's but i get 2 errors:

_Assets/Standard Assets/Utility/ForcedReset.cs(3,19): error CS0234: The type or namespace name `SceneManagement' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference?_
_
Assets/Standard Assets/Utility/TimedObjectActivator.cs(4,19): error CS0234: The type or namespace name `SceneManager' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference?

_
I don't know any programming languages yet, but I am taking C++ in school this semester so by the end, maybe I'll understand how to use unity a little more?


----------



## Deleted User (Sep 9, 2016)

It looks like "SceneManager" and "SceneManagement" aren't valid functions in UnityEngine.dll. (Perhaps they were replaced with another function in an older version of Unity?)

Could you possibly post the code for the 2 scripts? More specifically, snippets of code where the invalid "SceneManager" and "SceneManagement" functions are used.

As for you taking C++ courses, it may or may not help you; it kinda depends... Unity is C#/Java based (I highly recommend C#!), however for console editions of Unity, you can write your own plugins in native C++ using the respective console SDK.
I mean, C++ does have similar/same parts of C#, but you do get language-specific stuff sometimes.


----------



## Mr.ButtButt (Sep 9, 2016)

Voxel said:


> It looks like "SceneManager" and "SceneManagement" aren't valid functions in UnityEngine.dll. (Perhaps they were replaced with another function in an older version of Unity?)
> 
> Could you possibly post the code for the 2 scripts? More specifically, snippets of code where the invalid "SceneManager" and "SceneManagement" functions are used.
> 
> ...


they offer 2 part courses for Java and one for C++
I was told that C++ was more useful so i took that on xp.


----------



## Deleted User (Sep 9, 2016)

Yeeahh, I don't recall ever using UnityEngine.SceneManager/Management in my projects.

It seems that the only thing it's used for is the LoadScene function, however you can just do...

```
Application.LoadLevel("SceneName");
```

...Instead of using SceneManager.

After that, your scripts should be fine.


----------



## Mr.ButtButt (Sep 9, 2016)

Voxel said:


> Yeeahh, I don't recall ever using UnityEngine.SceneManager/Management in my projects.
> 
> It seems that the only thing it's used for is the LoadScene function, however you can just do...
> 
> ...



I changed it to:

```
Application.LoadScene(SceneManagement.GetSceneAt(0).path);
```

and nothing's changed :c

--------------------- MERGED ---------------------------



Mr.ButtButt said:


> I changed it to:
> 
> ```
> Application.LoadScene(SceneManagement.GetSceneAt(0).path);
> ...


okay so i changed the .LoadScene thing to exactly what you put, and i got another 2 random errors. I don't know if this is ever gonna work.. Unity is so fickle


----------



## Celisuis (Oct 18, 2016)

Mr.ButtButt said:


> I changed it to:
> 
> ```
> Application.LoadScene(SceneManagement.GetSceneAt(0).path);
> ...



Not sure if you managed to fix this, but to use SceneManager, you'll need to do two things:

1st - Add:

```
using UnityEngine.SceneManagement;
```

to you using directives.

Next, change 
	
	



```
Application.LoadLevel("SceneName");
```
to

```
SceneManager.LoadScene("SceneName");
```

SceneManager.LoadScene will accept int or string variables.


----------



## Mr.ButtButt (Oct 19, 2016)

Celisuis said:


> Not sure if you managed to fix this, but to use SceneManager, you'll need to do two things:
> 
> 1st - Add:
> 
> ...


I didn't fix it, actually. Also, I'm not sure if I even still have the project file. Unity has been a huge pain for me, so I may have deleted the project lol. I'll definitely look for it and try your suggestions, thanks


----------



## Mr.ButtButt (Oct 19, 2016)

Celisuis said:


> Not sure if you managed to fix this, but to use SceneManager, you'll need to do two things:
> 
> 1st - Add:
> 
> ...


okay so i found my project file, but there's lots of different assets, and I have no clue which to add/ change these in..


----------



## Celisuis (Oct 19, 2016)

SceneManagement is the new api that focuses on LoadScenes and Retrieving Scenes. 

You may have warnings or errors stating that Application.LoadLevel is obsolete. 

Are you using VS Studio for scripting at all?


----------



## Mr.ButtButt (Oct 19, 2016)

Celisuis said:


> SceneManagement is the new api that focuses on LoadScenes and Retrieving Scenes.
> 
> You may have warnings or errors stating that Application.LoadLevel is obsolete.
> 
> Are you using VS Studio for scripting at all?


I am using Visual Studio, and I dont have any error regarding "Application.LoadLevel is obsolete"
I have 2 errors right now, and they say:

*"Assets/Standard Assets/Utility/ParticleSystemDestroyer.cs(44,39): error CS1061: Type `UnityEngine.ParticleSystem' does not contain a definition for `emission' and no extension method `emission' of type `UnityEngine.ParticleSystem' could be found (are you missing a using directive or an assembly reference?)"*


*"Assets/Standard Assets/Utility/ParticleSystemDestroyer.cs(45,26): error CS1061: Type `object' does not contain a definition for `enabled' and no extension method `enabled' of type `object' could be found (are you missing a using directive or an assembly reference?)"*


----------



## Celisuis (Oct 19, 2016)

The first error is relating to the particle system which got an overhaul.

Can you post that script? I can have a look at it for you.


----------



## Mr.ButtButt (Oct 19, 2016)

I think both of them relate to the particle system.
I hate when software gets rid of something entirely. Like, just keep it the same so that people dont have to trouble themselves with not knowing how to use the damn thing :/

Here's the script 

```
using System;
using System.Collections;
using UnityEngine;
using Random = UnityEngine.Random;

namespace UnityStandardAssets.Utility
{
    public class ParticleSystemDestroyer : MonoBehaviour
    {
        // allows a particle system to exist for a specified duration,
        // then shuts off emission, and waits for all particles to expire
        // before destroying the gameObject

        public float minDuration = 8;
        public float maxDuration = 10;

        private float m_MaxLifetime;
        private bool m_EarlyStop;


        private IEnumerator Start()
        {
            var systems = GetComponentsInChildren<ParticleSystem>();

            // find out the maximum lifetime of any particles in this effect
            foreach (var system in systems)
            {
                m_MaxLifetime = Mathf.Max(system.startLifetime, m_MaxLifetime);
            }

            // wait for random duration

            float stopTime = Time.time + Random.Range(minDuration, maxDuration);

            while (Time.time < stopTime || m_EarlyStop)
            {
                yield return null;
            }
            Debug.Log("stopping " + name);

            // turn off emission
            foreach (var system in systems)
            {
                var emission = system.emission;
                emission.enabled = false;
            }
            BroadcastMessage("Extinguish", SendMessageOptions.DontRequireReceiver);

            // wait for any remaining particles to expire
            yield return new WaitForSeconds(m_MaxLifetime);

            Destroy(gameObject);
        }


        public void Stop()
        {
            // stops the particle system early
            m_EarlyStop = true;
        }
    }
}
```

--------------------- MERGED ---------------------------

btw, I'm taking a C++ class, and use Visual studio in there. Unity Automatically Uses MonoDevelop. Should I switch it to VisualStudio?


----------



## Celisuis (Oct 19, 2016)

I generally use VS for everything code related, it's a nice environment.

For the first error, try changing:


```
var emission = system.emission;
emission.enabled = false;
```

to 
	
	



```
var emit = system.emission;
emit.enabled = false;
```


----------



## Mr.ButtButt (Oct 19, 2016)

Celisuis said:


> I generally use VS for everything code related, it's a nice environment.
> 
> For the first error, try changing:
> 
> ...


i tried this
both errors are still there.

--------------------- MERGED ---------------------------



Mr.ButtButt said:


> i tried this
> both errors are still there.


would you like it if I sent you the whole project?


----------



## Celisuis (Oct 20, 2016)

Mr.ButtButt said:


> i tried this
> both errors are still there.
> 
> --------------------- MERGED ---------------------------
> ...



It'll probably be easier


----------



## Mr.ButtButt (Oct 20, 2016)

S


Celisuis said:


> It'll probably be easier


Sorry that I took so friggin' long. I got too caught up in all this NX stuff.
Here's the link to the project file:
https://mega.nz/#!LNknzCqa!W6UX_J4Y8dPiCaWZYDAhqmOHZMNjMc7N-nbMPGJHRqA


----------



## Celisuis (Oct 20, 2016)

No worries! I've been reading up on the NX pretty much all day. 

It's strange, I opened up the solution, and it pretty much compiled straight away. I didn't receive the two errors you did above, but received two different ones, which I fixed in TimedObjectActivator - you'll see as I've commented it for you.

https://mega.nz/#!xtEHWQZK


----------



## Mr.ButtButt (Oct 20, 2016)

i need the decryption key


----------



## Celisuis (Oct 20, 2016)

Oops, always forget that.

https://mega.nz/#!xtEHWQZK!v7yapenschA-5VceXix2MQkqBom0xQLNzLw9S0kbu14


----------



## Mr.ButtButt (Oct 20, 2016)

Celisuis said:


> Oops, always forget that.
> 
> https://mega.nz/#!xtEHWQZK!v7yapenschA-5VceXix2MQkqBom0xQLNzLw9S0kbu14


This is taking a much longer time than I expected..


----------



## Celisuis (Oct 20, 2016)

What's taking longer?


----------



## Mr.ButtButt (Oct 20, 2016)

Celisuis said:


> What's taking longer?


it just finished transfering files. loading up the project now.

--------------------- MERGED ---------------------------

okay I got the TimeObjectActivator error, and no other one now.. The only comment that I see in the code is that of the added scene management module


----------



## Celisuis (Oct 20, 2016)

What's the exact error?


----------



## Mr.ButtButt (Oct 20, 2016)

Celisuis said:


> What's the exact error?


Assets/Standard Assets/Utility/TimedObjectActivator.cs(7,19): error CS0234: The type or namespace name `SceneManagement' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference?


----------



## Celisuis (Oct 20, 2016)

You may be using an old version of unity? Mine is 5.4.0f3 and SceneManagement is valid namespace.


----------



## Mr.ButtButt (Oct 20, 2016)

mine is 5.2.4f1
I'm a nintendo dev partner and don't know whether upgrading will get rid of the ability to export to either systems..


----------



## Celisuis (Oct 20, 2016)

I'm not entirely sure, as I haven't got my Nintendo stuff installed yet, I've mainly been developing for PC. But I would imagine you can upgrade fine, afterall - the most recent version is generally always better.


----------



## Mr.ButtButt (Oct 20, 2016)

Celisuis said:


> I'm not entirely sure, as I haven't got my Nintendo stuff installed yet, I've mainly been developing for PC. But I would imagine you can upgrade fine, afterall - the most recent version is generally always better.


also, I checked the Unity Editor Update Check and it says mine is up to date : 5.2.4f1
I dont know how to upgrade without that..
Also, I've never even really programmed anything before. I'm taking a C++ class now to learn, but with most of this shit i'm on my own lol
so i'm really glad this issue may be able to get resolved after about 3-4 months now


----------



## JJ1004 (Jul 8, 2021)

Mr.ButtButt said:


> also, I checked the Unity Editor Update Check and it says mine is up to date : 5.2.4f1
> I dont know how to upgrade without that..
> Also, I've never even really programmed anything before. I'm taking a C++ class now to learn, but with most of this shit i'm on my own lol
> so i'm really glad this issue may be able to get resolved after about 3-4 months now



I had that sence issue today and fixed it by going into the window tab at the top in unity and then click package manager and updated vs code and you can use 
 Application.LoadLevel(1);
I hope I helped


----------

