Giter VIP home page Giter VIP logo

Comments (22)

stormtek avatar stormtek commented on July 3, 2024

The only way a you can declare something is by creating a new script for the file. So if you have two copies of the file ResourceManager.cs in your project (I know, you shouldn't but it is possible) then this could be your problem. That is the first thing I would check for. I have never come across this problem myself so I don't know what else to suggest at this stage sorry.

from unity-rts-demo.

Flam1ngDem0n avatar Flam1ngDem0n commented on July 3, 2024

I don't have any other copy or file that uses ResourceManager. I even tested this in a new project that has no new assets, nothing imported or anything. Apparently ResourceManager is already being used prior to this project calling for it. At least that's what has been said on Unity Answers.

from unity-rts-demo.

stormtek avatar stormtek commented on July 3, 2024

I wonder if this problem is being caused by the version of Unity? I think I have a copy of that version of Unity on my machine, so I will checkout my project from Github and try it there. I will get back to you with what happens.

from unity-rts-demo.

stormtek avatar stormtek commented on July 3, 2024

So I just opened this project in Unity 4.3.4 (it did upgrade the project in the process, but that shouldn't make any difference for this test). It gives me no errors at all, certainly not the one you have mentioned. I will try adding just that file to a brand new project and see what happens.

from unity-rts-demo.

stormtek avatar stormtek commented on July 3, 2024

I'm still not getting this problem - even when creating a new project and copying across the ResourceManager.cs and all the files needed to clear dependency errors. I am using the code from the latest part of the tutorial, so maybe that doesn't have the problem? I will revert my trial project back to the part where this was introduced and see if that brings up the problem (since I presume that is where you noticed the error).

from unity-rts-demo.

stormtek avatar stormtek commented on July 3, 2024

Even when trying this with the original addition of ResourceManager to the project (in part 2) I am still not getting an error in Unity 4.3.4 on OSX 10.9.2. Did this work fine for a while for you and then break? Or did it break when you first tried to add ResourceManager to your project?

from unity-rts-demo.

Flam1ngDem0n avatar Flam1ngDem0n commented on July 3, 2024

It broke when I first tried to create and add the ResourceManager to my project.

from unity-rts-demo.

stormtek avatar stormtek commented on July 3, 2024

Yea, that is the place that would make sense for it to break. Could you post the exact code you are using for ResourceManager here? Cos I created a new project and added just the ResourceManager script to it and nothing broke.

What platform are you developing on? (It shouldn't make a difference, but you never know) Also, when you created a new project did you leave everything as default?

from unity-rts-demo.

Flam1ngDem0n avatar Flam1ngDem0n commented on July 3, 2024

I am using a Windows 7 64-Bit PC. As for the project, I created a blank project (meaning a brand new one to test the script) with noting imported. Just a 100% blank project. Here is what I have scripted down.

using UnityEngine;
using System.Collections;

namespace RTS {
public static class ResourceManager {
public static int ScrollWidth { get { return 15; } }
public static float ScrollSpeed { get { return 25; } }
public static float RotateAmount { get { return 10; } }
public static float RotateSpeed { get { return 100; } }
public static float MinCameraHeight { get { return 10; } }
public static float MaxCameraHeight { get { return 40; } }
}
}

Pretty much straight from your tutorial really.

from unity-rts-demo.

stormtek avatar stormtek commented on July 3, 2024

That is weird then. Because I too created a brand new project and added just what you added (again to test the script) and had no problems ...

from unity-rts-demo.

Flam1ngDem0n avatar Flam1ngDem0n commented on July 3, 2024

Does it have something to do with Unity being the Pro version?

from unity-rts-demo.

stormtek avatar stormtek commented on July 3, 2024

That is entirely possible. So check whether there is a ResourceManager defined inside Unity Pro? Although it is namespaced, so that shouldn't be an issue.

from unity-rts-demo.

Flam1ngDem0n avatar Flam1ngDem0n commented on July 3, 2024

Where exactly would you recommend I check? I have Unity Pro, I just am unsure where to look.

from unity-rts-demo.

stormtek avatar stormtek commented on July 3, 2024

I don't know sorry. To see if it is a problem with Unity Pro you could rename this. So add a new C# script called MyResourceManager with the following code in it
using UnityEngine;
using System.Collections;

namespace RTS {
public static class MyResourceManager {
public static int ScrollWidth { get { return 15; } }
public static float ScrollSpeed { get { return 25; } }
public static float RotateAmount { get { return 10; } }
public static float RotateSpeed { get { return 100; } }
public static float MinCameraHeight { get { return 10; } }
public static float MaxCameraHeight { get { return 40; } }
}
}

and see what happens. I know it is an ugly work around, but if it helps you get on with the project ... it is worth a shot.

from unity-rts-demo.

Flam1ngDem0n avatar Flam1ngDem0n commented on July 3, 2024

So that was able to fix that. Though now something else appeared as an error. I am not sure why it did not show up before, but here is the error.

error CS0246: The type or namespace name `Player' could not be found. Are you missing a using directive or an assembly reference?

from unity-rts-demo.

stormtek avatar stormtek commented on July 3, 2024

Quite often an error will hide other subsequent errors - particularly when linking code. Is this error being thrown in a trial project or in the main project you are working on? It sounds to me like you are trying to call Player.something rather than player.something somewhere.

from unity-rts-demo.

Flam1ngDem0n avatar Flam1ngDem0n commented on July 3, 2024

It is in my main project. This is what I am typing in. Its straight from the tutorial linked to this repository.

private Player player;

That might be what is causing the issue. Not sure though.

from unity-rts-demo.

stormtek avatar stormtek commented on July 3, 2024

If you have not created the class Player yet then it will complain.

from unity-rts-demo.

Flam1ngDem0n avatar Flam1ngDem0n commented on July 3, 2024

So apparently adding the entire project of script and code to my main project folder fixed it. Still this was confusing because the way the tutorial is written; it makes it seem like you can go page by page and it should work per page and not by the whole tutorial. Just a quick suggestion, you might want to rework the tutorial a bit.

Plus, I noticed that there a lot of warnings when using the code from this repository. They refer to the camera a lot too.

Thanks for the help!

from unity-rts-demo.

stormtek avatar stormtek commented on July 3, 2024

You can work through the tutorial part by part. And there are several times during each part where you can run things fine - I normally mention this by saying something along the lines of 'You should now be able to run your game and see X working now'. But at a random point in a given post I cannot guarantee that because we are adding things that break the project for a bit.

In regards to those warnings, this code is being written in Unity 4.1. I am sticking with that since doing otherwise breaks the link between the code in the tutorial and the code here on github. I know that Unity 4.3 has changed parts of the api - in particular in regards to the camera.

from unity-rts-demo.

Flam1ngDem0n avatar Flam1ngDem0n commented on July 3, 2024

Ok. Understandable. Thanks for your help. Much appreciated.

from unity-rts-demo.

stormtek avatar stormtek commented on July 3, 2024

No problem. I'm glad you managed to get things going.

from unity-rts-demo.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.