Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by MNNoxMortem · Jul 21, 2017 at 01:58 PM · monobehaviournamespacecompiler bug

Unity 5.6.0p3 does not recognize class inside namespace

This works:

 using Zenject;
 public class UiSignalInstaller : MonoInstaller
 {
     public override void InstallBindings()
         {
         Container.DeclareSignal<RoomSelectionChangedSignal>();
     Container.Bind<RoomSelectionHandler>().AsSingle().NonLazy();
             }
 }
 public class RoomSelectionChangedSignal : Signal { }
 

This does not:

 namespace Zenject.Installers.UI
 {
     public class UiSignalInstaller : MonoInstaller<UiSignalInstaller>
     {
         public override void InstallBindings()
         {
             Container.DeclareSignal<RoomSelectionChangedSignal>();
             Container.Bind<RoomSelectionHandler>().AsSingle().NonLazy();
         }
     }
 
     public class RoomSelectionChangedSignal : Signal<int, RoomSelectionChangedSignal> { }
 }

The library Zenject is placed under Plugins if this matters. I don't get a specific error warning, just "fix compiler issues" which is very unspecific. The only reason I found the solution is by trial-and-error.

I just realized there are tons of cases where the compiler is warning wrongly. Even if a variable is passed as parameter to a method. I am pretty sure this should not be the case.

Comment
Add comment · Show 3
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 ifdef_ben · Jul 21, 2017 at 04:45 PM 0
Share

Just a hunch, is it possible the scope of your namespace is just more restricted than before?

In your first example you have access to the whole Zenject namespace. In your second example it's restricted to Zenject.Installers.UI.. maybe you still need to keep the "using Zenject;" ?

avatar image tanoshimi · Jul 21, 2017 at 05:09 PM 0
Share

Not near a computer to test at the moment, but you seem to have changed several things between the two code snippets - not just containing in a namespace:

  • The second example implements a generic interface - $$anonymous$$onoInstaller<UiSignalInstaller> rather than simply $$anonymous$$onoInstaller.

  • Also, you've changed the definition of RoomSelectionChangedSignal : Signal { } to RoomSelectionChangedSignal : Signal<int, RoomSelectionChangedSignal> { }

Not sure that these will explain the compilation errors, but it bothers my scientific tendencies to try to draw conclusions from a controlled experiment when you've varied more than one factor!

avatar image MNNoxMortem · Jul 21, 2017 at 05:19 PM 0
Share

Arg... No. It is actually the same. The changed generics were swallowed by the unity editor before I had formatted the text as code correctly or during the copy-paste. I am going to load up the project and fix the two code examples above. Anyway: Good call!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by eskivor · Jul 22, 2017 at 01:17 AM

try using Zenject.Installers.UI; instead of just using Zenject;

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

70 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do c# scripts get accessed by the Unity Engine 2 Answers

What we can achieve by putting MonoBehaviour inside namespaces? 1 Answer

UnityEngine found but MonoBehaviour or Vector3 not found in MonoDevelop 1 Answer

using UnityEditor outside of Editor folder when compiling build? 4 Answers

namespaces and script names 0 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