Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

[Question-Solved but not for release] Access class cid from string

Discussion in 'Project Tiny' started by LauraLaureus, Dec 19, 2018.

  1. LauraLaureus

    LauraLaureus

    Joined:
    Oct 5, 2018
    Posts:
    9
    Hi everyone!

    I have been playing with the Tweens module and since providing the cid of the class to tween is mandatory and I want to create my systems as generic as possible I would like to ask:

    Does exists a way to access a class type from a string?

    Ideally my component has the full name of the class and the system read it and gets the cid to add to the TweenComponent.

    I tried the solution provided here with no luck: https://stackoverflow.com/questions...s-reflection-for-typescript/15339429#15339429

    Thanks in advantage
     
  2. LauraLaureus

    LauraLaureus

    Joined:
    Oct 5, 2018
    Posts:
    9
    After some "in-navigator" research I found a solution:

    Code (JavaScript):
    1. window["_ut_Core2D_TransformLocalPosition_cid"]();
    Keep atention to the fact we have to replace '.' in class name to '_'.

    I hope it helps to somebody.