Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Wibbs 1 · Mar 21, 2011 at 10:16 PM · javascriptinheritanceuce0001abstract

Wierd problem with abstract classes and import statements in Javascript

Hey all,

I've run into a strange problem with my code. I want to create an abstract class with a private variable as a Dictionary but the code I'm using throws up a syntax error. I've narrowed it down to a problem with the combination of an import statement and the abstract keyword. For example:

import System.Collections.Generic;

abstract public class NewClass extends BaseClass { }

gives the error 'UCE0001: ';' expected. Insert a semicolon at the end.' on the 'abstract public class...' line but I have no idea why. Removing either the import statement or abstract keyword gets rid of the error.

Can anyone enlighten me as to why the error is there in the first place?

Thanks,

Wibbs

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DaveA · Mar 21, 2011 at 10:26 PM 0
Share

Is BaseClass also abstract? Can you use abstract on derived classes? On classes derived from non-abstract classes?

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Mike 3 · Mar 22, 2011 at 06:05 AM

I don't think UnityScript supports abstract classes

abstract class BaseClass
{
}

by itself throws the same error, and

public abstract class BaseClass
{
}

throws an unexpected token error

On the other hand, I don't know how you're managing to get it compiling just by removing the import

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Wibbs 1 · Mar 22, 2011 at 06:29 PM 0
Share

This gets more strange. I thought it supported abstract classes. For example:

pragma strict

abstract public class BaseEvent

{

 public function BaseEvent()

 {

 }

 

 public function BaseEvent(timeStamp: long)

 {

     this.timeStamp = timeStamp;

 }

 

 

 public var id : String;

 public var timeStamp : long;

}

doesn't throw an error and works fine. I've been assu$$anonymous$$g that this meant the abstract part works properly, but having just checked, Unity will happily let me create a BaseEvent, even though its marked as abstract.

avatar image Mike 3 · Mar 22, 2011 at 06:34 PM 0
Share

Hah, that's fantastic. So it's basically just a syntax error or parsed out, either way unsupported.

avatar image
-1

Answer by shinriyo_twitter · Oct 05, 2012 at 04:44 AM

your BaseEvent is no work

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Using functions of Inherited classes 3 Answers

How should I structure my unit class relationships? 1 Answer

Error UCE0001 ';' Expected. 1 Answer

Dreaded UCE0001 ';' error 2 Answers

Calling coroutines through pointers/"Function" class? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges