Comments (22)
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.
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.
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.
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.
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.
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.
It broke when I first tried to create and add the ResourceManager to my project.
from unity-rts-demo.
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.
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.
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.
Does it have something to do with Unity being the Pro version?
from unity-rts-demo.
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.
Where exactly would you recommend I check? I have Unity Pro, I just am unsure where to look.
from unity-rts-demo.
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.
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.
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.
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.
If you have not created the class Player yet then it will complain.
from unity-rts-demo.
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.
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.
Ok. Understandable. Thanks for your help. Much appreciated.
from unity-rts-demo.
No problem. I'm glad you managed to get things going.
from unity-rts-demo.
Related Issues (7)
- It seems like the 2d Hud is missing in this latest version. HOT 2
- Enhancement - Multiple units in queue for War Factory or Refinery? HOT 3
- Enhancement - Multiplayer HOT 3
- Won't run in Unity 5: "The referenced script on this Behavior is missing" HOT 2
- Continue of this tutorial HOT 6
- Are you going to make a new series?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unity-rts-demo.