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

Mr.ButtButt

The Cancer Of Gbatemp <3
OP
Member
Joined
Sep 22, 2015
Messages
1,465
Trophies
0
XP
883
Country
United States
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..
 

Mr.ButtButt

The Cancer Of Gbatemp <3
OP
Member
Joined
Sep 22, 2015
Messages
1,465
Trophies
0
XP
883
Country
United States
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?
 
D

Deleted User

Guest
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

The Cancer Of Gbatemp <3
OP
Member
Joined
Sep 22, 2015
Messages
1,465
Trophies
0
XP
883
Country
United States
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.
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.
error.png
 
D

Deleted User

Guest
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...
Code:
Application.LoadLevel("SceneName");

...Instead of using SceneManager.

After that, your scripts should be fine.
 

Mr.ButtButt

The Cancer Of Gbatemp <3
OP
Member
Joined
Sep 22, 2015
Messages
1,465
Trophies
0
XP
883
Country
United States
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...
Code:
Application.LoadLevel("SceneName");

...Instead of using SceneManager.

After that, your scripts should be fine.

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

and nothing's changed :c

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

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

and nothing's changed :c
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

Member
Newcomer
Joined
Aug 22, 2013
Messages
15
Trophies
0
Age
29
XP
124
Country
I changed it to:
Code:
Application.LoadScene(SceneManagement.GetSceneAt(0).path);

and nothing's changed :c

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


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

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

1st - Add:
Code:
using UnityEngine.SceneManagement;

to you using directives.

Next, change
Code:
Application.LoadLevel("SceneName");
to
Code:
SceneManager.LoadScene("SceneName");

SceneManager.LoadScene will accept int or string variables.
 
Last edited by Celisuis,
  • Like
Reactions: Mr.ButtButt

Mr.ButtButt

The Cancer Of Gbatemp <3
OP
Member
Joined
Sep 22, 2015
Messages
1,465
Trophies
0
XP
883
Country
United States
Not sure if you managed to fix this, but to use SceneManager, you'll need to do two things:

1st - Add:
Code:
using UnityEngine.SceneManagement;

to you using directives.

Next, change
Code:
Application.LoadLevel("SceneName");
to
Code:
SceneManager.LoadScene("SceneName");

SceneManager.LoadScene will accept int or string variables.
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 :D
 

Mr.ButtButt

The Cancer Of Gbatemp <3
OP
Member
Joined
Sep 22, 2015
Messages
1,465
Trophies
0
XP
883
Country
United States
Not sure if you managed to fix this, but to use SceneManager, you'll need to do two things:

1st - Add:
Code:
using UnityEngine.SceneManagement;

to you using directives.

Next, change
Code:
Application.LoadLevel("SceneName");
to
Code:
SceneManager.LoadScene("SceneName");

SceneManager.LoadScene will accept int or string variables.
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

Member
Newcomer
Joined
Aug 22, 2013
Messages
15
Trophies
0
Age
29
XP
124
Country
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?
 
  • Like
Reactions: Mr.ButtButt

Mr.ButtButt

The Cancer Of Gbatemp <3
OP
Member
Joined
Sep 22, 2015
Messages
1,465
Trophies
0
XP
883
Country
United States
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

Member
Newcomer
Joined
Aug 22, 2013
Messages
15
Trophies
0
Age
29
XP
124
Country
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

The Cancer Of Gbatemp <3
OP
Member
Joined
Sep 22, 2015
Messages
1,465
Trophies
0
XP
883
Country
United States
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
Code:
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

Member
Newcomer
Joined
Aug 22, 2013
Messages
15
Trophies
0
Age
29
XP
124
Country
I generally use VS for everything code related, it's a nice environment.

For the first error, try changing:

Code:
 var emission = system.emission;
emission.enabled = false;

to
Code:
var emit = system.emission;
emit.enabled = false;
 
  • Like
Reactions: Mr.ButtButt

Mr.ButtButt

The Cancer Of Gbatemp <3
OP
Member
Joined
Sep 22, 2015
Messages
1,465
Trophies
0
XP
883
Country
United States
I generally use VS for everything code related, it's a nice environment.

For the first error, try changing:

Code:
 var emission = system.emission;
emission.enabled = false;

to
Code:
var emit = system.emission;
emit.enabled = false;
i tried this
both errors are still there.

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

i tried this
both errors are still there.
would you like it if I sent you the whole project?
 

Celisuis

Member
Newcomer
Joined
Aug 22, 2013
Messages
15
Trophies
0
Age
29
XP
124
Country
No worries! I've been reading up on the NX pretty much all day. :P

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
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: https://www.youtube.com/watch?v=uLN9qrJ8ESs