[Unity 5.5p3] Import failing with autogenerated code

Wed 11. Jan 2017, 14:27

Hey,

so I got as far as importing the project, but the automated code generation ran into an issue:

Code: Select all
Assets/Generated/Template.cs(31,67): error CS0542: `Articy.Die_Skatinsel_EN.Template.Template': member names cannot be the same as their enclosing type


The complete generated file reads like this:

Code: Select all
// ------------------------------------------------------------------------------
//  <autogenerated>
//      This code was generated by a tool.
//      Mono Runtime Version: 2.0.50727.1433
//
//      Changes to this file may cause incorrect behavior and will be lost if
//      the code is regenerated.
//  </autogenerated>
// ------------------------------------------------------------------------------

using System;
using System.Collections;
using UnityEngine;
using System.Collections.Generic;
using Articy.Unity;
using Articy.Unity.Interfaces;
using Articy.Die_Skatinsel_EN.Features;

namespace Articy.Die_Skatinsel_EN
{
   
   
    public class Template : Entity, IEntity, IPropertyProvider, IObjectWithFeatureTemplatefeature__Lektion
    {
       
        [SerializeField()]
        private ArticyValueTemplateTemplate mTemplate = new ArticyValueTemplateTemplate();
       
        private static Articy.Die_Skatinsel_EN.Templates.TemplateTemplateConstraint mConstraints = new Articy.Die_Skatinsel_EN.Templates.TemplateTemplateConstraint();
       
        public Articy.Die_Skatinsel_EN.Templates.TemplateTemplate Template
        {
            get
            {
                return mTemplate.GetValue();
            }
            set
            {
                mTemplate.SetValue(value);
            }
        }
       
        public static Articy.Die_Skatinsel_EN.Templates.TemplateTemplateConstraint Constraints
        {
            get
            {
                return mConstraints;
            }
        }
       
        public Templatefeature__LektionFeature GetFeatureTemplatefeature__Lektion()
        {
            return Template.Templatefeature__Lektion;
        }
       
        protected override void CloneProperties(object aClone)
        {
            Template newClone = ((Template)(aClone));
            if ((Template != null))
            {
                newClone.Template = ((Articy.Die_Skatinsel_EN.Templates.TemplateTemplate)(Template.CloneObject()));
            }
            base.CloneProperties(newClone);
        }
       
        public override bool IsLocalizedPropertyOverwritten(string aProperty)
        {
            return base.IsLocalizedPropertyOverwritten(aProperty);
        }
       
        #region property provider interface
        public override void setProp(string aProperty, object aValue)
        {
            if (aProperty.Contains("."))
            {
                Template.setProp(aProperty, aValue);
                return;
            }
            base.setProp(aProperty, aValue);
        }
       
        public override Articy.Unity.Interfaces.ScriptDataProxy getProp(string aProperty)
        {
            if (aProperty.Contains("."))
            {
                return Template.getProp(aProperty);
            }
            return base.getProp(aProperty);
        }
        #endregion
    }
}
Beardshaker_Bene
 
Posts: 2
Joined: Tue 10. Jan 2017, 13:21

Re: [Unity 5.5p3] Import failing with autogenerated code

Wed 11. Jan 2017, 14:48

Hi,

i knew someone would run into this eventually :)
Well yes, this is one of the shortcomings with our code generation. Unfortunately in this case, there is no other way but to change your templates technical name. The DisplayName doesn't matter and can be whatever you want.
As you see from the generated code, your templates will become generated classes, with a generated property called "Template", C# wise its not allowed to have a property inside a class with the same name as the class. In other words the class "Template" is not allowed to have a property named "Template". We had a similar problem if you had a feature called "event" or any other language reserved word.

Hope that helps and welcome in the beta

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: [Unity 5.5p3] Import failing with autogenerated code

Wed 11. Jan 2017, 15:06

Thanks!

I thought so too, however I did not put any constraints on the designers using Articy :D

There might be a LOT of keywords used in anywhere in there :/
Beardshaker_Bene
 
Posts: 2
Joined: Tue 10. Jan 2017, 13:21

Re: [Unity 5.5p3] Import failing with autogenerated code

Wed 11. Jan 2017, 23:45

There might be a LOT of keywords used in anywhere in there :/


I should have mentioned that we had this in the beta, but started to fix it. Which means that some of those keywords are already checked and will stop the export itself. So the beforementioned "event" property or feature in one of your templates will be catched. Nevertheless, i expect more still lurking :)
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Return to articy:draft Unity Importer

Who is online

Users browsing this forum: No registered users and 15 guests

Who We Are
Contact Us
Social Links