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
2
Question by Kijun · Feb 25, 2011 at 07:34 AM · instantiatebugstripping

Object.Instantiate produces error after I strip my iOS project

Can someone help me out with this?

Object instantiation worked fine before I stripped down my code, but when I stripped it (using strip bytecode setting), I started getting

Could not produce class with ID 64

My code goes like this...

public GameObject GetGameObjectAsset(WWW request, string key) { GameObject obj = (GameObject)request.assetBundle.Load(key, typeof(GameObject)); return CreateGameObject(obj) : obj); }

public GameObject CreateGameObject(GameObject obj)
{
if (obj == null) return null ;
Debug.Log(obj); // I get $myprefabname (UnityEngine.GameObject) GameObject newObj = (GameObject)Object.Instantiate(obj); // I get Could not produce class with ID 64
newObj.name = obj.name; return newObj; }

This error happens regardless of the stripping level (strip assemblies and strip bytecode).

Any help would be greatly appreciated.

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by tnetennba · Apr 05, 2012 at 03:23 PM

When you use stripping on your build if there no objects in the game that reference one of your scripts it will get stripped. So when you use only asset bundles this is very likely to happen. To avoid this simply create a scene that references all of the scripts that you need and they will then not be stripped. You can also check the section "how to deal with stripping when using reflection" on this page http://unity3d.com/support/documentation/Manual/iphone-playerSizeOptimization.html

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
avatar image
3

Answer by Tetrad · Oct 22, 2014 at 11:32 PM

The way I fixed it was by using the link.xml file and adding the class to it.

In my case, I had the error about id 120.

I looked up the class ID in the class ID reference: http://docs.unity3d.com/Manual/ClassIDReference.html

Then added that class to the link.xml file like so (it should be wrapped with `` tags, this is just an excerpt).

 <assembly fullname="UnityEngine">
     <type fullname="UnityEngine.LineRenderer" preserve="all"/>
 </assembly>
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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Why is my prefab spawing underneath my player when facing left but not right? 0 Answers

assertion failed on expression: 'GetSystemInterested(transform, system) != enable' 1 Answer

Instantiate spawns the object incorrectly. 0 Answers

RPC sync issues 0 Answers

Applying force to a rigidbody 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