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

Discussion in 'Computer Programming, Emulation, and Game Modding' started by Mr.ButtButt, Sep 9, 2016.

  1. Mr.ButtButt
    OP

    Mr.ButtButt The Cancer Of Gbatemp <3

    Member
    1,461
    599
    Sep 22, 2015
    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..
     


  2. Voxel

    Voxel Fable Junkie

    Member
    GBAtemp Patron
    Voxel is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    5,199
    5,925
    Jun 27, 2015
    United Kingdom
    England, UK
    I'm pretty skilled. What sort of errors are you encountering?
     
  3. Mr.ButtButt
    OP

    Mr.ButtButt The Cancer Of Gbatemp <3

    Member
    1,461
    599
    Sep 22, 2015
    United States
    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?
     
  4. Voxel

    Voxel Fable Junkie

    Member
    GBAtemp Patron
    Voxel is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    5,199
    5,925
    Jun 27, 2015
    United Kingdom
    England, UK
    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.
     
  5. Mr.ButtButt
    OP

    Mr.ButtButt The Cancer Of Gbatemp <3

    Member
    1,461
    599
    Sep 22, 2015
    United States
    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
     
  6. Voxel

    Voxel Fable Junkie

    Member
    GBAtemp Patron
    Voxel is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    5,199
    5,925
    Jun 27, 2015
    United Kingdom
    England, UK
    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.
     
  7. Mr.ButtButt
    OP

    Mr.ButtButt The Cancer Of Gbatemp <3

    Member
    1,461
    599
    Sep 22, 2015
    United States
    I changed it to:
    Code:
    Application.LoadScene(SceneManagement.GetSceneAt(0).path);
    
    and nothing's changed :c

    — Posts automatically merged - Please don't double post! —

    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
     
  8. Celisuis

    Celisuis Member

    Newcomer
    15
    5
    Aug 22, 2013
    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, Oct 18, 2016
    Mr.ButtButt likes this.
  9. Mr.ButtButt
    OP

    Mr.ButtButt The Cancer Of Gbatemp <3

    Member
    1,461
    599
    Sep 22, 2015
    United States
    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
     
  10. Mr.ButtButt
    OP

    Mr.ButtButt The Cancer Of Gbatemp <3

    Member
    1,461
    599
    Sep 22, 2015
    United States
    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..
     
  11. Celisuis

    Celisuis Member

    Newcomer
    15
    5
    Aug 22, 2013
    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 likes this.
  12. Mr.ButtButt
    OP

    Mr.ButtButt The Cancer Of Gbatemp <3

    Member
    1,461
    599
    Sep 22, 2015
    United States
    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?)"
     
  13. Celisuis

    Celisuis Member

    Newcomer
    15
    5
    Aug 22, 2013
    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.
     
  14. Mr.ButtButt
    OP

    Mr.ButtButt The Cancer Of Gbatemp <3

    Member
    1,461
    599
    Sep 22, 2015
    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;
            }
        }
    }
    
    — Posts automatically merged - Please don't double post! —

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

    Celisuis Member

    Newcomer
    15
    5
    Aug 22, 2013
    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;
    
     
    Mr.ButtButt likes this.
  16. Mr.ButtButt
    OP

    Mr.ButtButt The Cancer Of Gbatemp <3

    Member
    1,461
    599
    Sep 22, 2015
    United States
    i tried this
    both errors are still there.

    — Posts automatically merged - Please don't double post! —

    would you like it if I sent you the whole project?
     
  17. Celisuis

    Celisuis Member

    Newcomer
    15
    5
    Aug 22, 2013
    It'll probably be easier :)
     
  18. Mr.ButtButt
    OP

    Mr.ButtButt The Cancer Of Gbatemp <3

    Member
    1,461
    599
    Sep 22, 2015
    United States
  19. Celisuis

    Celisuis Member

    Newcomer
    15
    5
    Aug 22, 2013
    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
     
  20. Mr.ButtButt
    OP

    Mr.ButtButt The Cancer Of Gbatemp <3

    Member
    1,461
    599
    Sep 22, 2015
    United States
    i need the decryption key